Intraday High Low Staircase Plotting Issue

Hi,

It just plots the most recent high or low in intraday,
Instead i would like to staircase plottype new highs or New Lows registered in intraday.
Where i am wrong in this code?

xH=BarsSince(Day()!=Ref(Day(),-1));
yH=HHV(H,xH+1);
Hightoday=IIf(xH==0,yH,Ref(yH,0));

xL=BarsSince(Day()!=Ref(Day(),-1));
yL=LLV(L,xL+1);
LowTODAY=IIf(xL==0,yL,Ref(yL,0));

Plot(Hightoday, "Hightoday",colorBrightGreen,styleLine);
Plot(Lowtoday, "Lowtoday",colorPink,styleLine);

Any help would be appreciated.
Thanks
Gloria Filamino

You should rather use HighestSince/LowestSince instead all that code

NewDay = Day() != Ref( Day(), -1 );

HighToday = HighestSince( NewDay, High );
LowToday = LowestSince( NewDay, Low );
2 Likes

Thanks a Lot Tomasz.
Got what exactly i wanted.

Thanks,
Gloria Filamino