Adding Delay Of 3 Candles For Alerts

Hello All,
I have a AFL writtena dn I do the exploration every 5 minutes.

I wish to delay the alerts generated in the AFL by 3 candles (15 minutes delay)

To check the current candle in the formation is complete, I use

barcomplete = BarIndex() < LastValue(BarIndex());

How could I check to have completion of 3 candles and then get the alert.

Hello
This out of my head... but the logic is if the event happen 3 bars ago then give me a signal.

event = the buy signal here

Buy = ref(event, -3);  // BUY now if the event was 3 bars ago``
1 Like

Thanks @PanoS for your response.

Also I did the following and plotted the barcount variables to check them

barcomplete = BarIndex() < LastValue(BarIndex()-3);

This marks barcomplete=1 when the next 3 candles are formed, i.e. unless and untill x+3 candles are formed, the x will not be complete.