Color differently if highest high in last 20 bars= daily hhv(20)

i have a condition where i am coding if the highest high in last 20 bars is same as highest high value in last 20 days.
but for some reason, they dont work. as you can see in the screenshot. i do have the 30 min bars on top with the donchian channel and the daily bars in bottom
Need some help to fix my code.

TimeFrameSet( inDaily ); //switch to daily 

donchianhigh =H==HHV(H,-20);
donchianLow =l==llV(l,-20);

TimeFrameRestore(); //restore time frame to original  

donchianhigh_expanded =  TimeFrameExpand(donchianhigh, inDaily);
donchianLow_expanded =  TimeFrameExpand(donchianLow, inDaily);

highvalue =  HHV( High, 20 ) ;

Lowvalue =   LLV( Low, 20 );

Plot( Lowvalue, "Lowvalue", IIf(Lowvalue== donchianlow_expanded ,colorRed,colorOrange), styleDashed);
Plot( highvalue, "highvalue", IIf(highvalue== donchianhigh_expanded ,colorRed,colorOrange), styleDashed);
Plot( Close, "Price", colorWhite, styleCandle ); 

why is -20 used in HHV and LLV?

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.