RSI divergence – help coding

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #147462 quote
    boonet
    Participant
    Senior

    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

    #147471 quote
    boonet
    Participant
    Senior

    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

    2020-10-15_0953.jpg 2020-10-15_0953.jpg 2020-10-15_1225.png 2020-10-15_1225.png
    #147474 quote
    robertogozzi
    Moderator
    Master

    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.

    #147475 quote
    robertogozzi
    Moderator
    Master

    In your pic you haven’t two oversold or overbought signals, just one.

    #147478 quote
    boonet
    Participant
    Senior

    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 🙂

    #147481 quote
    boonet
    Participant
    Senior

    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

    #147490 quote
    robertogozzi
    Moderator
    Master

    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")
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

RSI divergence – help coding


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
boonet @boonet Participant
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by robertogozzi
5 years, 5 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 10/15/2020
Status: Active
Attachments: 2 files
Logo Logo
Loading...