Comparing BB with RSI is impossible, since the first one refers to prices, while the latter to a range (0-100).
But for other indicators, yes it is easy, let’s say you want to know whether there’s been a CROSSOVER in anyone of the last 3 bars:
FastMA = average [ 5 ,0 ] (close )
SlowMA = average [ 25 ,0 ] (close )
x = summation [ 3 ] (FastMA CROSSES OVER SlowMA) //x will be true if the crossing occurred within anyone of the last 3 bars
IF x THEN ......
If you want to test specifically the 2nd previous bar you can write:
x = FastMA[ 2 ] CROSSES OVER SlowMA[ 2 ] //x will be true if in the 2nd previous bar there's been a crossover
or (it works the same):
x = FastMA CROSSES OVER SlowMA //x will be true if there's a crossover
IF x[ 2 ] THEN //you test x for the 2nd previous bar
.
.
ENDIF