RSI Divergences finder

v10.3
RSI Divergences finder

This indicator finds the divergences between price and RSI and draw a segment (on price on RSI or both) at the highest value between the two peaks (for bullish divergencies) or at the lowest value reached between the two bottoms (for bearish divergencies). I use this levels as entry for long/short positions. Only when the price close above or under this levels I have an entry signal. On the picture is hard to see the segments because PRT doesn’t allow to change the tickness and the style.

Blue skies

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Nicolas • 04/19/2017 #

    Another clever, well coded and commented code! Well done gabri! This one will be a “best downloader” for sure 🙂

    • gabri • 04/19/2017 #

      Thank you Nicolas, said by you it’s a big compliment!!
       

  2. Francesco78 • 04/19/2017 #

    Great stuff, thank you

  3. Francesco78 • 04/19/2017 #

    Gabri, when I add the indicator on the bottom of the chart I dont get an RSI style line like the one you show, but only a series of +1 or -1 signal, and when I add it in the price chart, the graph is shrinking. 
    What am I missing?
    Apologies.

    • gabri • 04/19/2017 #

       
      Francesco,
      no apologies. The only thing I can think of is that the version of your PRT is different than mine. Send me a picture and I will try to figure it out. To avoid the 1 and -1 you have to dash out the lines 22,27,28, 39,44,45 and change line 56 with a simple return.

  4. Francesco78 • 04/19/2017 #

    Thank you Gabri, will try and let you know

  5. Francesco78 • 04/19/2017 #

    What you told me to do fixed the problem in the chart but I still dont see the indicator curve..

    • gabri • 04/19/2017 #

      Francesco,
      there is no curve for this indicator, only horizontal lines (segments) meant to be entry levels for the trades.

  6. Francesco78 • 04/19/2017 #

    Ok, I understood. Thank you!

  7. Andy • 04/19/2017 #

    Hi Gabri, i’ve tried your code but it ‘s totally different from the one in your pictures.. it misses the horizontal lines on  i am not allowed to attach file to show you..

    • gabri • 04/19/2017 #

      Andy,
      did you try to slash out the lines 22,27,28, 39,44,45 and change line 56 with a simple return?
       

  8. Andy • 04/19/2017 #

    wow what a speed reply.. i’ll try and let you know, thanks

  9. Andy • 04/19/2017 #

    before trying i noticed that it says there is error on line 24 and 26

  10. gabri • 04/19/2017 #

    Andy,
    could it be that the PRT version you are using doesn’t support the function DRAWSEGMENT?

  11. Andy • 04/19/2017 #

    i dont know Gabri.. how can i check?

  12. gabri • 04/19/2017 #

    It should say your version when you start the program. Do you see any lines on the RSI graph?

  13. Andy • 04/19/2017 #

    no i dont see any lines..
    I have a mac and my version is Java 1.0

  14. gabri • 04/19/2017 #

    I am not sure about the problem. If you have the 10.3 version of PRT you should be able to see it. Sorry!!

  15. gabri • 04/19/2017 #

    Ok, try this. On the price window (or on the RSI window) click on the wrench symbol, then choose “Add indicator” and click on the indicator “mio-divergenza-rsi”. Does it work like this?

  16. Andy • 04/19/2017 #

    i have only “Mio-rsi sui prezzi” as indicatore available, is it this one?

  17. gabri • 04/19/2017 #

    Andy, that was another code I made. You should either import the mio-divergenza-rsi.itf file that you find in the attachments or copy the code above and make a new indicator on your PRT (you can name it the way you want). After these steps are done click on the wrench symbol, then choose “Add indicator” and click on the indicator you just made (or imported)

  18. Andy • 04/19/2017 #

    wow.. probably i did something wrong.. let me try 😀

  19. Andy • 04/19/2017 #

    ok tried.. it says:
    Errore nell’indicatore: Mio – divergenza RSIErrore di sintassi: Linea 22, carattere 12Uno dei seguenti caratteri sarebbe più appropriato di “(“:– “,”– “=”

  20. gabri • 04/19/2017 #

    In my code there is no character 12 on line 22!! can you tell me which is your line 22?

  21. Andy • 04/19/2017 #

    22 DRAWSEGMENT(BarBullNew, highest[(BarBullnew-BarBullOld)](close), BarBullNew+10, highest[(BarBullnew-BarBullOld)](close))//entry price for long on RSI window // double slash next line if not needed24 DRAWSEGMENT(BarBullNew, highest[(BarBullnew-BarBullOld)](a), BarBullNew+10, highest[(BarBullnew-BarBullOld)](a))
    There is a warning signal on both..
     

  22. gabri • 04/19/2017 #

    Ok, I believe your version of PRT doesn’t support the command drawsegment. You should check with the helpdesk.

  23. Andy • 04/19/2017 #

    ok thanks!

  24. Mert • 04/19/2017 #

    Hello Gabri,
    I looked at your divergence finder and it looks great. Is there a possible that you write some extra code so that the divergence is only found in oversold and overbought levels? That would be highly appreciated. Thanks in advance and with warmest regards,

  25. gabri • 04/19/2017 #

    Mert,
    instead of the following line:
    if RefCloseDownNewRefRSIDownOld then

    just write
    if RefCloseDownNewRefRSIDownOld and aRefCloseUpOld and RefRSIUPNewRefCloseUpOld and RefRSIUPNew70 then

    it should help.

  26. JohnScher • 04/19/2017 #

    Great work, I like very much!

    Can you encode this for other indicators that also provide strong divergence signals? Maybe MACD, stochastics, momentum.

    I have in mind to create a divergence strategy, let’s say 5 divergences, and if 3 out of 5 agree the trade is started.

    See Screenshort attached, the 1x you can see
    Bearic divergences of CCI, MACD, RSI in the same candle
    Bullish divergences of CCI, MACD, RSI in the same candle

    Accordingly, the share price “follows” the divergences…

    Can you program that?

    Translated with http://www.DeepL.com/Translator

  27. gabri • 04/19/2017 #

    Thanks John. I guess you can change line 2 to use some other indicators. I use only RSI and RMI and so I tailored this code around it. to use MACD you can change line 2 to read a=MACDline[12,26,9](close) (or MACD[12,26,9](close)).

  28. JohnScher • 04/19/2017 #

    Only the indicators change in line 2? That’s all? I’ll try it!
    I’ll answer when it’s done.

    Thank´s so lot.

  29. Mert • 04/19/2017 #

    Thanks, Gabri.

  30. Kris75 • 04/19/2017 #

    Fantastic job ; hugely useful ;
    Thanks Gabri 😉

  31. gabri • 04/19/2017 #

    Kris, you are always too nice!!

  32. Kris75 • 04/19/2017 #

    Based on this wonderful job I would like to propose this little change in the code that allows to make the divergent highs and lows more conspicuous on the RSI chart;
    (sorry to post the code like this, but the insert does not seem to work here )
    Best

    //Variables
    a=rsi[14](close)
    once RefCloseDownOld=0
    once RefRSIDownOld=0
    once RefCloseUpOld=0
    once RefRSIUpOld=0
    once BarBullOld=0
    once BarBearOld=0
    //Conditions to identify max and min
    c1=a[4]>a[2] and a[3]>a[2] and a[1]>a[2] and a>a[2] // bottom
    c2=a[4]<a[2] and a[3]<a[2] and a[1]<a[2] and a<a[2] // top
    //finding the double bottom
    if c1 then
    RefCloseDownNew=close[2]
    RefRSIDownNew=a[2]
    BarBullNew=barindex[2]
    endif
    if RefCloseDownNewRefRSIDownOld then
    //double slash next line if you don’t needed the mark on a different window
    bulldiv=a*0.9
    //entry price for long on price window // double slash next line if not needed
    //DRAWSEGMENT(BarBullOld, RefCloseDownOld – 2, BarBullNew, RefCloseDownNew – 2)coloured(255,0,0)
    //entry price for long on RSI window // double slash next line if not needed
    DRAWSEGMENT(BarBullOld, RefRSIDownOld – 2, BarBullNew, RefRSIDownNew – 2)coloured(255,0,0)
    else
    bulldiv=0
    endif
    //Finding the double top
    if c2 then
    RefCloseUpNew=close[2]
    RefRSIUpNew=a[2]
    BarBearNew=barindex[2]
    endif
    if RefCloseUpNew>RefCloseUpOld and RefRSIUPNew<RefRSIUpOld then
    //double slash next line if you don't needed the mark on a different window
    beardiv=a*0.9
    //entry price for short on price window // double slash next line if not needed
    //DRAWSEGMENT(BarBearOld, RefCloseUpOld – 2, BarBearNew, RefCloseUpNew – 2)coloured(255,0,0)
    //entry price for short on RSI window // double slash next line if not needed
    DRAWSEGMENT(BarBearOld, RefRSIUpOld + 2, BarBearNew, RefRSIUpNew + 2)coloured(255,0,0)
    else
    beardiv=0
    endif

    RefCloseDownOld=RefCloseDownNew
    RefRSIDownOld=RefRSIDownNew
    RefCloseUpOld=RefCloseUpNew
    RefRSIUpOld=RefRSIUpNew
    BarBullOld=BarBullNew
    BarBearOld=BarBearNew

    //grafica
    return bulldiv coloured (0,255,0) style (histogram,1), beardiv coloured (255,0,0) style (histogram,1)

  33. Cedlam • 04/19/2017 #

    Bonjour à tous,
    J’ai essayé de mettre de la couleur et les segments restent blanc.
    Avez-vous une solution ?
    D’avance merci.

  34. Djo • 04/19/2017 #

    Not working on V11. The RSI doesn’t appear on the chart.

  35. Mika83 • 04/19/2017 #

    Bonjour,
    J’ai des soucis de lecture de syntaxe avec la variable “drawsegment” sur la version PRT 2021 gratuite. Et par ailleurs sur beaucoup d’autre code de divergence RSI, car beaucoup utilise cette variable. Je cherche un screener de divergences RSI et je n’ai pas le niveau pour régler ce probleme… Pourriez-vous m’aider, merci d’avance.

  36. seb234 • 04/19/2017 #

    Salut Mika, j’ai la version V11.1, la formule fonctionne. Mais il est préférable, dixit Nicolas, d’importer la formule (mio-divergenza-rsi.itf) plutôt que de faire un copier coller

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+11 more likes

Related users ' posts
luxrun grazie Ivàn!
lee Thank you. Is it possible to convert this to a screener that displays instruments when bulli...
Iván //---------------------------------------------------------------// //PRC_Pollan Indicator /...
Faisalx ChatGPT Hola Iván. Gracias por tu excelente trabajo. Te agradecería si pudieras echarle un...
Iván ok, perfecto! me pongo con ello
Iván
8 months ago
Iván Hi, Sorry, but what do you mean?
luiskohnen Hola, queria saber si el indicador repinta, porque a mi me parecio que si. Saludos y gracias...
Diamant Bonsoir, L'un d'entre vous peut-il me donner les définissions de LL-HH-LH et HL. Merci d'av...
Bernard13 (Je réécris mon commentaire -français- en français car certains mots ne correspondaient pas ...
Iván 1000 indicateurs !!! brutaux
Lean Me parece muy buen indicador, y se complementa muy bien en mi sistema, ¿podrías crear un scr...
Iván Gracias! Para el screener sólo tienes que copiar el indicador y poner como condición de búsq...
Lean Muchas gracias Iván, ya lo he podido crear.
Bateson
1 year ago
Matriciel Very nice job ! Is it possible to do the opposite because what interests me is to have the ...
YvesRobert Hi Matriciel, how can we do this, because stochastic is limited between 0 and 100 but price ...
Traderfox06 Dear zeiiermantrading, I really like your approach combining adaptive averages with MACD in...
jacquesgermain Hello IASD it's normal , when this occurs, uncheck RSI and MFI line and click then the MAC...
emiliobercial Thank you very much for sharing!
Carlose estoy de acuerdo con IASD Esta muy bien el MAD y el indicador en el precio no se ven bien...
bousalahane merci pour le partage de cet l'indicateur, j'ai rajouté un autre indicateur pour faire une s...
joaoarcher Hi, thank you for the this. Is it possible to create a screener from this indicator, so that...
KumoNoJuzza Thanks. I did not know IG had Futures. I am always missing an info or a detail. I used to th...
joaoarcher Hi, thank you for the this. Is it possible to create a screener from this indicator, so that...
superfalcio Last very good gain of the system: positions on Eurostoxx50 closed yesterday friday 06/12/2024.
Nicolas
2 years ago
3 RSI
3 RSI
2
Indicators
Violet Nicolas, you calculate iRSI, but don't use it. You show RSI in the returned values, which, a...
Nicolas Yes, that's an error. RSI instruction is set by default to 14 if you don't indicate it that'...
DELBERT Bonjour , Nicolas , je voudrais installer cet indicateur sur ma PRT , version 10.3 , mais je...
Nicolas En effet, il faut à minima une version 11. La 10.3 est tellement ancienne maintenant.. Je pe...
DELBERT Bonjour , Nicolas , merci pour ta réponse , je fais un essai et je verrais . Salutations .
Khaled Thank you Nicolas! Looks like TDI (Trader Dynamic Index). Interesting to give Exit Signal as...
Nicolas ColorBetween is an instruction added last year: https://www.prorealcode.com/documentation/co...
finplus Bonjour, serait-il possible de remplacer l'écart formé par les bandes de Bollinger par l'ATR...
robertogozzi An updated version can be found here https://www.prorealcode.com/topic/conversion-of-pine-sc...
jissey Bonjour Robertogozzi, cet indicateur est interessant mais serait-il possible de marquer la ...
robertogozzi Sure, but you should start a new topic on the Probuilder support forum. Thank you :)
AntoGH Bonjour peut-on backtester cela ? Et si vous l'avez fait pourriez vous nous donner le code.....
Nicolas désolé c'est un oubli de ma part, tu peux supprimer cette ligne, elle n'est plus utile dans ...
DELBERT Bonjour , Nicolas , merci pour ta réponse , je suis en effet avec PRT 10.3 , et j'ai bidouil...
supertiti https://zupimages.net/viewer.php?id=20/50/2e3v.jpg
volanirina Bonjour Je souhaite l'avoir sur l'indicateur MT4 si possible s'il vous plait. car je l'ai fa...
Nicolas ProRealCode est un site dédié à l'utilisation de la plateforme de trading ProRealTime: https...
Pensera Bravo Nicolas ! Tu es en quelque sorte l’inventeur de Metascore…(oups je viens de lire jusqu...
Nicolas Dans un but d'investissement pure, et non spéculatif.
Enigma08 Hi Juanj. I am new to ProrealTime and I am trying to program the Proscreener. I want the Pro...

Top