Hi I need some help. I'm trying to find the high price between two times during the day. In this case I want to find the high between the open and 10:30 ET, so the first hour of the day. And I want it to display a label on my chart. I do it but the high doesn't exactly line up with the high in that timeframe on my chart. For example for SPY on 12/16/2022, it says the open to 10:30 high was 385.43, but really it was 386.58. What am I doing wrong?
input startTime = 0930;
input endTime = 1030;
def Active = SecondsFromTime(startTime) >= 0 and SecondsTillTime(endTime) >= 0;
def HighFirst60Min = if Active and !Active[1] then high else HighFirst60Min[1];
AddLabel(1, "Open to 10:30 High = " + HighFirst60Min, Color.PINK);
# Open to 10:30 high
input startTime = 0930;
input endTime = 1030;
def Active = SecondsFromTime(startTime) >= 0 and SecondsTillTime(endTime) >= 0;
def HighFirst60Min = if Active and !Active[1] then high else HighFirst60Min[1];
AddLabel(1, "Open to 10:30 High = " + HighFirst60Min, Color.PINK);
# Open to 10:30 high