I am trying this following code to use it as an overlay for opening range breakout. The issue is that apart from the current session, it is also plotting last two sessions. But I don’t need that. How can I fix this issue? Below is the code -
_SECTION_BEGIN("Intraday ORB");
BT = ParamTime ("Open Breakout Time", "09:15");
afterbreakout0 = Cross(TimeNum(),BT);
afterbreakout1 = TimeNum()>=BT;
NewDay = Day()!= Ref(Day(), -1);
highestoftheday = HighestSince(newday,H,1);
Lowestoftheday =LowestSince(newday,L,1);
ORBH = ValueWhen(afterbreakout0,highestoftheday,1);
ORBL = ValueWhen(afterbreakout0,lowestoftheday,1);
ORBM = (ORBH + ORBL)/2;
Plot(ValueWhen(NewDay, LastValue(ORBH, True), 1),"",colorGreen,styleDots | styleThick);
Plot(ValueWhen(NewDay, LastValue(ORBL, True), 1),"",colorRed,styleDots | styleThick);
Plot(ValueWhen(NewDay, LastValue(ORBM, True), 1),"", colorBlack, styleDots | styleThick);
_SECTION_END();
Thanks for your time and effort in advance. Regards.