Indicator Coding Help Please - Opening Range Box Indi - page 2

 

Your calculation for the opening range is wrong, you must incorporate the previous days low or high, or depending on if you want to use an intraday opening range, the last bar of the previous session must be incorporated, it is the transitioning information (time) from one day to the next you want to have in the opening range, so if you leave out the last bar of the previous session, that is about half of the information you will not have, it is not just to take the high and low of a 30 minute bar to get the 30 minute opening range,  here is to go about it prooperly.


lets say you want to do the midnight range starting at 00:00 and last to 00:30, 30 minutes. that would be a simple 30 minute daily range. 

so on a 30 minute timeframe chart, you will then have a bar that closes at 00:00, this is the last bar of the previous session,

then the next bar closes at 00:30, Now, depending on if the high is higher on this bar than the last bars high that closed at 00:00, if it was,

then you use the low from the last bars low from the previous session, so that will be your opening range low,

if it was instead lower than the last bars low from the previous session,

you will then use the high of that bar as your opening range high

and the low of the current bars low as the opening range low.

these rules apply except for an inside day. in that case, only the high and low of the engulfing bar counts.

for gaps the opening range uses the low pre-gap and the folowing high


I am not a coder so I cant help you with that part, Im just a trader.

I hope this information will be helpful to anyone trying to create an opening range indicator. 


see attachments for visual examples

Files:
Reason: