Can you please help me code below screener algo ?
Bullish reversal signal:
- Find the last 2 RSI oversold signals
- if (Oversold signal[1] > Oversold signal[0])
- screen for Bullish reversal
Bearish reversal signal:
Opposite to Bullish signal
Ignore the aove, there is more to this –
Can you please help me code below screener algo ?
Bullish reversal signal:
- Find the last 2 RSI oversold signals (RSI > 70)
- if (RSIOversoldSignal[1] < RSIOversoldSignal[0]) and (priceAtOversoldSignal[1] > priceAtOversoldSignal[0])
- then screen for Bullish reversal
Bearish reversal signal:
Opposite to Bullish signal
There you go:
Ob = 70
Os = 100 - Ob
MyRsi = Rsi[14](close)
//
Cross = MyRsi CROSSES UNDER Os
IF Cross THEN
Bear2 = Bear1
Bear1 = MyRsi
ENDIF
B = Bear2 > Bear1
//
Cross = MyRsi CROSSES OVER Ob
IF Cross THEN
Bull2 = Bull1
Bull1 = MyRsi
ENDIF
S = Bull2 < Bull1
//
SCREENER[B or S](MyRsi AS "Rsi")
since you did not specify how far from each other those two signals should be, I used a crossover.
In your pic you haven’t two oversold or overbought signals, just one.
Thanks @robertogozzi.
I think crossover works fine too. Yeah the quality of the signal is better when it is oversold, but it works for near overbought signals too.
I will try manually with a screener and then import it to proorder later. Thanks again 🙂
Hi @robertogozzi.
Couple of things from the above code –
- Not sure if you have seen my latest requirement criteria above. We need to check the price too when we have a RSI signal. Can you please add that too?
- The expectation is that the second RSI signal is caused by the current price, but not historic data. Because we will be taking entry based on the second RSI signal.
Please see this video for better clairty on what I am trying to do
Thanks
I cannot wath a 44-minute video.
You should recap conditions.
This is my code modified to add diverging price. Signals are rarely returned:
Ob = 70
Os = 100 - Ob
MyRsi = Rsi[14](close)
//
Cross = MyRsi CROSSES UNDER Os
IF Cross THEN
Bear2 = Bear1
Bear1 = MyRsi
Bull2 = 0
Bull1 = 0
Price2= Price1
Price1= close
ENDIF
B = (Bear2 > Bear1) AND Price2 < Price1
//
Cross = MyRsi CROSSES OVER Ob
IF Cross THEN
Bull2 = Bull1
Bull1 = MyRsi
Bear2 = 0
Bear1 = 0
Price2= Price1
Price1= close
ENDIF
S = (Bull2 < Bull1) AND Price2 > Price1
//
SCREENER[B or S](MyRsi AS "Rsi")