Start Indicator calculations at open and not use previous data?


Is there a way and does anyone have an indicator code example of how to only start calculating data for an indicator at the 9:30 bar?

I only want to use current day data and nothing else? So if the indicator asks to look back 5 bars, i'd like it to only look at the available bar data until the 5th bar is created and then move forward.

Trying to do something like this for example:

input n = 8;
def beginDay = if barNumber() < n then barNumber() else n;

Highest(high, beginDay);

but looks like Highest requires the value to be a constant.

How can i do that?

Similar threads