Plotting lines Current day/Last Day only

I am trying to draw yesterday LOW and yesterday High only current day . Don't want lines on previous days .. Appreciate if someone can help me


yDayH = 	TimeFrameGetPrice("H", inDaily, -1);	   		yDayHI = LastValue (yDayH,1); 		// yesterdays high
yDayL = 	TimeFrameGetPrice("L", inDaily, -1);	 		yDayLI = LastValue (yDayL,1);			// yesterdays low
yDayC = 	TimeFrameGetPrice("C", inDaily, -1);	 		yDayCI = LastValue (yDayC,1);			// yesterdays close

Plot(yDayH  ," ", colorRed, styleLine | styleNoLabel );
Plot(yDayL  ," ", colorGreen, styleLine | styleNoLabel );

image

Just add one extra line and modify Plot()

yDayH = 	TimeFrameGetPrice("H", inDaily, -1);	   		yDayHI = LastValue (yDayH); 		// yesterdays high
yDayL = 	TimeFrameGetPrice("L", inDaily, -1);	 		yDayLI = LastValue (yDayL);			// yesterdays low
yDayC = 	TimeFrameGetPrice("C", inDaily, -1);	 		yDayCI = LastValue (yDayC);			// yesterdays close

Today = Day() == LastValue( Day() );

Plot( IIf( Today, yDayH, Null ) , " ", colorRed, styleLine | styleNoLabel );
Plot( IIf( Today, yDayL, Null ) , " ", colorGreen, styleLine | styleNoLabel );

DHDL

3 Likes

Thanks a Lot @Milosz

1 Like