Dear friends, I need to calculate the range from low to high during the period from 18:00 (when the new session [ETH] starts after a one-hour pause in NQ futures) until 16:55 of the following day (when the after market of the next session ends). I have managed to do it with the code I provide, but I have to change the date each time. (the time remains constant). Can this be done without needing parameters and be done automatically every time?
startDate = ParamDate("Start Date","2025-06-24");
startTime = ParamTime("Start Time","18:00:00",0);
endDate = ParamDate("End Date","2025-06-25");
endTime = ParamTime("End Time","16:55:00",0);
startPoint=IIf(TimeNum()>=startTime AND DateNum()==startDate,1,0);
startPoint=(startPoint-Ref(startPoint,-1))==1;
endPoint=IIf(TimeNum()>=endTime AND DateNum()==endDate,1,0);
endPoint=(endPoint-Ref(endPoint,-1))==1;
timeWindow=Flip(startPoint,endPoint);
myHigh=ValueWhen(timeWindow,HighestSince(startPoint,High));
myLow=ValueWhen(timeWindow,LowestSince(startPoint,Low));
SetBarsRequired(1500,0);
SetChartOptions(0, chartShowDates);
Plot(C,"",colorGrey40,64);
Plot(startPoint,"",ColorRGB(0,0,200), styleArea|styleOwnScale,0,1,0,-1);
Plot(endPoint,"",ColorRGB(200,0,0), styleArea|styleOwnScale,0,1,0,-1);
Plot(myHigh,"\nmyHigh",colorAqua,styleLine);
Plot(myLow,"\nmyLow",colorOrange,styleLine);
Title = EncodeColor(colorAqua)+ "myHigh = " + WriteVal(LastValue(myHigh),1.2)+ EncodeColor(colorOrange)+ "\nmyLow = " + WriteVal(LastValue(myLow),1.2) + EncodeColor(colorYellow) +"\nrange H-L = " + WriteVal(LastValue(myHigh-myLow),1.2);