ramaParticipant
Senior
I am trying find out high during specific session such as between 8 am till 12.30 what is highest close
c1=time>=080000 and time<=143000
c2= highest[40](high)
if c1 then
c2= highest[40](high)
endif
return c2
I wrote the above code but it bring only highest of 40 candles all the time ( i counted the candles between which is 40)
For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part!
Thank you!
Try this
If time = 080000 then
c2 = close
Endif
If time <= 123000 then
c2 = max(c2,close)
Endif
return c2
ramaParticipant
Senior
the above code is not working, please find the screen shot attached
Works just fine for me. What time frame chart are you applying it to as there are no details at all in your screen shot?
1 minute screenshot attached.
ramaParticipant
Senior
Works fine, I was in custom trading hours
ramaParticipant
Senior
how get the same value for previous day or 2 days ago
There you go:
If time = 080000 then
Previous2 = Previous1
Previous1 = c2
c2 = close
Endif
If time <= 123000 then
c2 = max(c2,close)
Endif
return c2,Previous1,Previous2 //c2=today, Previous1=yesterday, Previous2=the day before yesterday