RSI Failure swing

Hi,

I have been searching for code for RSI failure swing but can not find it. My current code does not work at all,
what s the problem ?


change = 3;

t= Trough(RSI1,change,1); 
p= Peak(RSI1, change,1); 

tp = BarsSince(Ref(t,-1))> BarsSince(p) AND BarsSince(p) > BarsSince(t) ;   


condFW_Up = t > Ref(t,-1) AND  RSI1 > tp;

You might want to start by reading the help for Peak and Trough.

As you will see from the links, Peak and Trough return the value of the input array at the point the Peak or Trough occurred. So in order to detect when that was, you need to check when the array last equalled that value:

eg

p = Peak(RSI1, change, 1);
BarsSincePeak = BarsSince(RSI1 == p)
1 Like