How do I make a chart label to show intraday high and low after a certain price first occurs ?
For example, stock A reaches $10 at 9:45, this label would show stock A's highest high and lowest low after being traded at $10 (from 9:30 to 15:59)
Ruby:#HHLL_PullBack_After_Developing_HODs input showlabel_HH = yes; input showlabel_First_HH = yes; #Time Defined input timezone = {default "ET", "CT", "MT", "PT"}; def starthour = (if timezone == timezone."ET" then 9 else if timezone == timezone."CT" then...
How do I make a chart label to show intraday high and low after a certain price first occurs ?
For example, stock A reaches $10 at 9:45, this label would show stock A's highest high and lowest low after being traded at $10 (from 9:30 to 15:59)
Ruby:#HHLL_PullBack_After_Developing_HODs input showlabel_HH = yes; input showlabel_First_HH = yes; #Time Defined input timezone = {default "ET", "CT", "MT", "PT"}; def starthour = (if timezone == timezone."ET" then 9 else if timezone == timezone."CT" then 8 else if timezone == timezone."MT" then 7 else 6) ; def hour = Floor(((starthour * 60 + 30) + (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000) / 60); def minutes = (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000 - ((hour - starthour) * 60 + 30) + 60; #Highest High during RTH plot bn = BarNumber(); #bn.setpaintingStrategy(paintingStrategy.VALUES_BELOW); def rth = Between(GetTime(), RegularTradingStart(GetYYYYMMDD()), RegularTradingEnd(GetYYYYMMDD())); def multihighs = if GetDay() == GetLastDay() and rth then if high == high(period = AggregationPeriod.DAY) then multihighs[1] + 1 else multihighs[1] else 0; def firsthibn = if multihighs[1] == 0 and multihighs == 1 then bn else firsthibn[1]; def hihr = if bn == HighestAll(firsthibn) then hour else hihr[1]; def himin = if bn == HighestAll(firsthibn) then minutes else himin[1]; def dh = if bn == HighestAll(firsthibn) then high else dh[1]; AddLabel(showlabel_HH, "DH@ " + ((hihr + ":") + (if himin < 10 then "0" + himin else "" + himin)) + " ; " + dh, Color.GREEN); def nexthh = if GetDay() == GetLastDay() and rth and bn > HighestAll(firsthibn) then Max(high, nexthh[1]) else nexthh[1]; AddLabel(1, "HH after DH: " + HighestAll(nexthh), Color.LIGHT_GREEN); def nextll = CompoundValue(1, if GetDay() == GetLastDay() and rth and bn == HighestAll(firsthibn) then low else if bn > HighestAll(firsthibn) then Min(low, nextll[1]) else nextll[1], low); AddLabel(1, "LL after DH: " + (nextll), Color.LIGHT_RED); #
The above code is for a live session. I actually would use such label after a trading session is finished. I manually enter the price, then it shows me relevant values.As the developing HOD occurs, then this code from the first HOD and thereafter, will find the subsequent HH/LL until a nwe higher HOD occurs.
You could try using the code for 30 bars I provided and leave the debug on to find the bar/count that has the price you want to useThe above code is for a live session. I actually would use such label after a trading session is finished. I manually enter the price, then it shows me relevant values.
In my previous example, I would enter $10 to input, and the label would show me highest high and lowest low after stock A being firstly traded at $10 in the ended session
Yeah, saw you post about that. it's a bit different in this case. I figure it's better to input a price rather than a bar, because if the highest high or lowest low occur in that same beginning bar (30th bar), it's gonna skip it. whereas high and low after a certain price point leave out the concept of 'Bars', so won't have that problem.You could try using the code for 30 bars I provided and leave the debug on to find the bar/count that has the price you want to use
Hi Guys, i want to plot a label for high/low of the day time only. is there any study available for High low time for the day?
Ruby:input timezone = {default "ET", "CT", "MT", "PT"}; def starthour = (if timezone == timezone."ET" then 9 else if timezone == timezone."CT" then 8 else if timezone == timezone."MT" then 7 else 6) ; def hour = Floor(((starthour * 60 + 30) + (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000) / 60); def minutes = (GetTime() - RegularTradingStart(GetYYYYMMDD())) / 60000 - ((hour - starthour) * 60 + 30) + 60; #Highest High during RTH def begin = CompoundValue(1, if gettime() crosses above regularTradingStart(getyyyYMMDD()) then high else if high > begin[1] then high else begin[1] , begin[1]); def beginbn = if GetDay() == GetLastDay() then if high == begin then BarNumber() else beginbn[1] else 0; def highday = if BarNumber() == HighestAll(beginbn) then high else highday[1]; plot hdcross = if high == highday then high else Double.NaN; hdcross.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN); def hihr = if high == highday then hour else hihr[1]; def himin = if high == highday then minutes else himin[1]; AddLabel(1, "H: " +(hihr + ":") + (if himin < 10 then "0" + himin + " - " + highday else "" + himin + " - " + highday) , Color.WHITE); #Lowest Low During RTH def begin1 = CompoundValue(1, if gettime() crosses above regularTradingStart(getyyyYMMDD()) then low else if low < begin1[1] then low else begin1[1], low); def beginbn1 = if GetDay() == GetLastDay() then if low == begin1 then BarNumber() else beginbn1[1] else 0; def lowday = if BarNumber() == HighestAll(beginbn1) then low else lowday[1]; plot ldcross = if low == lowday then low else Double.NaN; def lowhr = if low == lowday then hour else lowhr[1]; def lowmin = if low == lowday then minutes else lowmin[1]; AddLabel(1, "L: " + " " + (lowhr + ":") + (if lowmin < 10 then "0" + lowmin + " - " + lowday else "" + lowmin + " - " + lowday) , Color.WHITE); plot hd = highday; hd.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); plot ld = lowday; ld.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); input bubbles = yes; AddChartBubble(bubbles and !IsNaN(hour) and IsNaN(hdcross[1]) and hdcross, high, hour + ":" + if minutes < 10 then "0" + minutes + " - " + hd else "" + minutes + " - " + hd, Color.WHITE, yes); AddChartBubble(bubbles and !IsNaN(hour) and IsNaN(ldcross[1]) and ldcross, low, hour + ":" + if minutes < 10 then "0" + minutes + " - " + ld else "" + minutes + " - " + ld, Color.WHITE, no);
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
T | Add label: Yesterday High, Low, close by 10:15 AM | Questions | 0 | |
T | get previous day high low without day aggregation | Questions | 2 | |
D | Label with Low and Time after the High of Day | Questions | 6 | |
T | high / low count script | Questions | 2 | |
S | after market & pre market high low lines help | Questions | 5 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.