is_first = na(t[1]) and not na(t) or t[1] < t ending_hour = input(defval=9, title="Ending Hour", type=input.integer) ending_minute = input(defval=30, title="Ending Minute", type=input.integer)
day_high = float(na)
if is_first and barstate.isnew and (hour < ending_hour or hour >= 16 or hour == ending_hour and minute < ending_minute) day_high := high else day_high := day_high[1]
if high > day_high and ((hour < ending_hour or hour >= 16) and hour < 16 or hour == ending_hour and minute < ending_minute) day_high := high day_high