assistance with using time since signal

Folks I want to use in script for showbar that a slow stochastic of 10 etc. periods crosses below say 25 in the last (eg.5 days/bars) and the gann 3 bar swing turns up within the (5 days/bars of crossing below the stoch 25 line . I know how to script for the the gann swing and stochs etc. as below, but I can’t work out effectively get the time frame since signal correct. any help appreciated

thanks in advance

a1 = gannswing()turnsup;
a2 = stochscan();
a1 and a2

Hi,

You could use the TimeSinceSignal() function.

Wrap the Timesincesignal() around a2 variable and it will generate a count of how long it has been since it last triggered.

You can then set the criteria to TimeSinceSignal(a2) <= 5

You can see further examples here: https://help.optuma.com/kb/faq.php?id=1030

Thanks Maatthew I have sorted it now, mucho appreciated