Hi, can someone help to create an indicator showing me th First Hour Opening Range?
in other word the Initial Balance for the first hour of trading drawing in a box from 0o am to 23 pm like showing in the picture.
There you go:
//DEFPARAM DrawOnLastBarOnly = true
StartTime = 000000
EndTime = 010000
IF OpenTime = StartTime OR ((OpenTime > StartTime) AND (OpenTime < OpenTime[1])) THEN
myBar = BarIndex
HH = high
LL = low
ENDIF
IF (OpenTime >= StartTime) AND (OpenTime <= EndTime) THEN
HH = max(HH,high)
LL = min(LL,low)
ENDIF
IF OpenTime >= EndTime THEN
DrawSegment(myBar,HH,BarIndex,HH) coloured("Blue",255)
DrawSegment(myBar,LL,BarIndex,LL) coloured("Red",255)
ENDIF
RETURN
Thank you, just one thing
I want it to stay for the 1 Hour range in every time frame, can you tell me where to add a code for it?
That will show exactly, for any timeframe equal or less than 1 hour, the HIGH and LOW of the first hour (or whatever time you choose), from 0 to 23.
i have made this change to get it
timeframe(1 hour) // I declare the timeframe, if not this will give the high and low of the first candle of the timeframe selected
And thank you.
I just copied and changed your code to apply it for the 15 minutes openning range, i got a scaling scaling down like in the picture here attached, can you tell me where is my error?
Thank you
//DEFPARAM DrawOnLastBarOnly = true
timeframe(15mn)
StartTime = 143000// this is my zone start time
EndTime = 000000
IF OpenTime = StartTime OR ((OpenTime > StartTime) AND (OpenTime < OpenTime[1])) THEN
myBar = BarIndex
HH = high
LL = low
ENDIF
IF (OpenTime >= StartTime) AND (OpenTime <= EndTime) THEN
HH = max(HH,high)
LL = min(LL,low)
ENDIF
IF OpenTime >= EndTime THEN
DrawSegment(myBar,HH,BarIndex,HH) coloured("Green",255)
DrawSegment(myBar,LL,BarIndex,LL) coloured("Red",255)
ENDIF
RETURN HH AS "OPR 15min High",LL AS "OPR 15min Low"
There is no error, I used DRAWSEGMENT and DEFPARAM DrawOnLastBarOnly = true to prevent this.
With RETURN you can’t change what has been printed in the prior candles, so you will always see steps when there’a new high or low. It can’t be gotten rid of.
Thank you, i have a tradingview that doesnt show steps but it is a close source, so i can’t read it.