Hello @markizta69,
Firstly, I haven't addressed your question, merely looked at your code, as I think there's a problem with the way you've specified the Retest
condition(s).
Have a look at the following enhancement of your own code, for any symbol with several hundred quotes:
// Insert this code into a chart, and observe the first screen-full of quotes.
// Then scroll through the remaining quotes, one quote at a time. Make a note of ABs behaviour.
// Then, un-comment the following line to force AB to use _all_ prior bars, not just the ones it thinks are needed.
//SetBarsRequired(sbrAll, 0) ;
Resistance = Ref(HHV(H,20),-1);
Breakout = Cross(C,Resistance);
BreakoutLevel = Ref(Valuewhen(Breakout,Resistance), -1);
Retest1 = Cross(BreakoutLevel,L);
cumRestest1 = Cum(Retest1) ;
Retest2 = Retest1 AND Cum(Retest1) ==1 ;
Retest3 = Retest2 AND BarsSince(Breakout) < 20;
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
Plot(cumRestest1, "cumRestest1", ParamColor("cumRestest1 Color", colorDefault ), ParamStyle("cumRestest1 Style", styleLine));
PlotShapes(shapeDigit1 * retest1, colorRed, 0, Low, -10) ;
PlotShapes(shapeDigit2 * retest2, colorGreen, 0, Low, -20) ;
PlotShapes(shapeDigit3 * retest3, colorBlue, 0, Low, -30) ;
What do you notice?
By-the-way, it would be easier to read your messages if you follow the suggestions in this post:
How to use this site
Secondly, we can address your question better, if you can provide a clearer description of what it is that you want: