Record multiple values in amibroker?

I have a breakout and retest setup to buy. I have coded it but it only records the latest breakout and forgets the previous breakouts. What if there is a breakout and there is no retest to it and then there is again a breakout and this time retest is there. Here I still want AFL to keep record the first breakout too. How do I make AFl to record multiple values?Capture1

Here I want to my AFL to keep recording 1) breakout and also record future breakouts too when they happen

Here is my afl

Resistance = Ref(HHV(H,50),-1);
Breakout = Cross(C,Resistance);
Breakout = Ref(Sum(Breakout,21) == 0,-1) AND Breakout AND C > (Resistance + Ref(ATR(5),-1));
BreakoutLevel = Ref(Valuewhen(Breakout,Resistance),-1);
Retest = Cross(BreakoutLevel,L);
Retest = Retest AND Cum(Retest) == 1;
Retest = Retest AND BarsSince(Breakout) < 21;

Attach screenshot ( Real Chart ) that show the result you came with it then it would be easier to receive help to solve your problem.

BTW, Is there a good reason for adding the below condition to your code ?

Retest = Retest AND Cum(Retest) == 1;

I just want the first retest to the support level, that's why this line.

The result is the retest to the support level ( shown as point 2 in the pic above)

Ok , got it but i think it will not work as you want as it will also add all retest 's signals that happen from the beginning of chart , not only the most recent retest

if you plot "breakout" variable it would show you all historical breakout signals , so where is the problem ?

Yes it will plot correctly. But I am more interested in exploration i.e I want to find out those stocks which have retested on the breakout today (any- whether recent or previous).

I hope you got it what I am trying to do.

@Malibutown
You coded it but it’s the same code posted by @markizta69 in this thread how-to-buy-at-the-high-close-of-the-retest-candle. Maybe I am missing something……….
Btw @fxshrat already posted working solution on that thread..... try that.

2 Likes

It is also recording the recent breakout and not all the previous breakout which have not been tested before.

Please help