Consider a situation where I need to check for 3 consecutive close above RSI(14). Not being from programming background, I attempted to code it this way
Filter = Close> RSI(14) AND Ref(Close,-1)>Ref(RSI(14),-1) AND Ref(Close,-2)>Ref(RSI(14),-2);
Intuitively, this piece of code appears crude and not so elegant. Now, if I have to do a backtest on sample data, say this time with 5 consecutive signals, then adding more instances of ref() seems wrong per se.
a) There should be a simpler and elegant method to filter for consecutive signals wherein one can control the number of repeat from another variable.
b) What would be best method to identify, say for example, repeat in 4 out of last 6 bars.
Thanks much