Hi,
Below is a line of my AFL code that looks for a bar’s high, which is higher than the day’s 2 times standard deviation of VWAP and also either of its previous two bars’ low is lower than a specified open range high (open range high is defined as highest high of first 45mins).
above2std = H>=(VWAP+2*SD) AND (Ref(L,1)<ORBH OR Ref(L,2)<ORBH);
Note  VWAP, SD etc variables are all defined correctly and i’ve tested the above code.
Now, i want to look for a bar that satisfies the follow condition 

the current bar’s closing price is crossing the 1 standard deviation of VWAP from below (i know how to code this condition)

with the above2std condition from mentioned above occurred within the last 120 bars (on a 3mins chart, so it means triggered either some time yesterday or today in conjunction with condition 1 above).
I tried using BarsSince(above2std), but the returned scan result didn’t seem right.
Is using BarsSince function the right way to accomplish what i want to do?
Any guidance would be much appreciated.
Regards,
Tony