Trigger Count /down

#1
Hello Friends, Experts,

I need some help with an AFL script...

What I need is..

If my buy condition is triggered, start a countdown of say 20 seconds and if the condition is still true, BUY.

Eg: Buy = EMA (C,1) > EMA (C,3) and this condition is true for more than 20 seconds; (I'm not using "cross" function here)

I need to know if this is possible...

Could someone shed some light on any AFL function that can achieve this? or maybe a reference script?

I also tried the below script.
Buy = IIf(buycondition , Secconds - int( Secconds / TimeFrame ) * TimeFrame,Null);

But the problem is that the countdown doesn't start from the time the "BUY" condition is true.

Looking forward to your assistance and guidance... Some clue... guidance... Direction... would be greatly appreciated.

I've searched the internet for this but could not get anything... They refer to BARCOUNT, SUMSINCE, TIMEFRAME, etc... Since I'm planning to work on intraday... I need to work in seconds...

Thanks!!