After a long work, I finally developed a simple, but useful RSI Divergences Indicator -Hey! another one?-
Yes, another one! (but I hope it is better than the default ProRealTime RSI Divergences Indicator).
This indicator finds both Direct (or Regular) and Hidden (or Inverse) RSI Divergences.
When a divergence is found, an Arrow is drawn to the chart and a text is added to the Arrow to mark the type of Divergence: “dd” = Direct Divergence; “hd” = Hidden Divergence
Indicator parameters:
Comparing my indicator with ProRealTime RSI Divergence Indicator (using same parameters values), i found that entry points are exactly the same, except for new arrows added by my indicator in case of hidden divergence. That’s why ProRealTime indicator shows only regular divergences.
You can play with parameters to change sensivity.
Briefly, an RSI Divergence screener will be follow.
Merry Christmas!
Ciao!
//RSI Divergences By Frank (Francesco)
//Description: the indicator draws arrows on chart as entry points when a direct or an hidden RSI divergence is found.
//When a DIRECT divergence is found, "dd" (direct divergence) text is added to chart over (Sell signal) or under (Buy signal) the arrow
//When an HIDDEN or INVERSE divergence is found, "hd" (hidden divergence) text is added to chart over (Sell signal) or under (Buy signal) the arrow
//Variables:
//RsiPeriod: number of bars to calculare RSI value
//RsiOverSold: Oversold Level
//RsiOverBought: OverBought Level
//MinBarRange: minimum distance from two consecutive RSI Highs or RSI Lows
Rge = averagetruerange[10](close)
MyRSI = rsi[RsiPeriod](Close)
ONCE ShiftText = 3
RsiMax = MyRSI < MyRSI[1] and MyRSI[1] > MyRSI[2] and MyRSI[1] > RsiOverBought
RsiMin = MyRSI > MyRSI[1] and MyRSI[1] < MyRSI[2] and MyRSI[1] < RsiOverSold
if RsiMax then
RSIMax1 = MyRSI[1]
High1 = High[1]
for I = MinBarRange to 80
if RsiMax[I] then
RSIMax2 = MyRSI[I + 1]
High2 = High[I + 1]
If High1 > High2 and RSIMax1 < RSIMax2 then
DRAWARROWDOWN(barindex, High + Rge / ShiftText)coloured(255,192,203,255)
DRAWTEXT("dd", barindex, High + Rge / ShiftText / 0.3,SansSerif,Italic,10)coloured(0,0,255,255)
elsif High1 < High2 and RSIMax1 > RSIMax2 then
DRAWARROWDOWN(barindex, High + Rge / ShiftText)coloured(255,192,203,255)
DRAWTEXT("hd", barindex, High + Rge / ShiftText / 0.2,SansSerif,Italic,10)coloured(0,0,255,255)
endif
break
endif
next
endif
if RsiMin then
RSIMin1 = MyRSI[1]
Low1 = Low[1]
for I = MinBarRange to 80
if RSIMin[I] then
RSIMin2 = MyRSI[I + 1]
Low2 = Low[I + 1]
If Low1 < Low2 and RSIMin1 > RSIMin2 then
DRAWARROWUP(barindex, lOW - Rge / ShiftText)coloured(0,0,255,255)
DRAWTEXT("dd", barindex, lOW - Rge / ShiftText / 0.3,SansSerif,Italic,10)coloured(0,0,255,255)
elsif Low1 > Low2 and RSIMin1 < RSIMin2 then
DRAWARROWUP(barindex, lOW - Rge / ShiftText)coloured(0,0,255,255)
DRAWTEXT("hd", barindex, lOW - Rge / ShiftText / 0.2,SansSerif,Italic,10)coloured(0,0,255,255)
endif
break
endif
next
endif
return
You must be logged in to post a comment.
Hi there, I have V11.1. I get the Indicator but no Arrows on the price. Kind Regards Michael
Hi Francesco, Great Indicator and thanks for sharing. How exactly does the MinRangeBar setting work? It sounds self explanatory but if i change from min 5 to min 3 some signals disappear - I would've thought that more would appear with the min bar range down. Is it based on the price or RSI? Regards, Geoff
Bonjour. je viens de telecharger cet indicateur .Malheureusement il ne fonctionne pas ou plus !? J'ai essayer deux fois sans succès . il s'affiche correctement mais aucune courbe ne s'affiche !! Quelqu'un aurait-il rencontrer le même problème que moi?. merci d'avance pour vos retours.
bonjour, merci pour cet indicateur très utile - Pouvez expliquer pourquoi l'indicateur apparaît dessous/dessus le chandelier lorsque la divergence est détectée sur les ut intraday alors qu'il apparaît le lendemain en ut journalière. j'ai testé les différents paramètres et je n'arrive pas à résoudre ce problème. merci pour vos retours. Ludovic
Hi Francesco I appreciate you uploaded this a long time ago but it is a useful indicator if you can't spot the divergences manually. Interestingly I've compared it on IG Index spreadbet chart data and ProRealTime real market data and it highlights more interesting divergences on the real data which I guess is not a surprise. I've uploaded an image that compares a 5 min chart and you can see the differences. Thought you or someone else might be interested. Cheers Rob
P.s. ho provato a togliere le divergenze nascoste (hd) dall'indicatore, ma nonostante inserisca gli stessi parametri, non mi da gli stessi segnali che mi da invece l'indicatore di divergenze rsi quello standard della piattaforma...
Ciao Francesco! Ti disturbo ancora per chiederti se conosci o se eventualmente pensi si possa generare un comando di buy o sell all'incrocio di 2 MM, ma dopo che si verifichi una divergenza sul tuo indicatore rsi...magari se ci fosse la possibilità anche di stabilire dopo quante barre dalla divergenza il segnale possa definirsi valido...per esempio mi scatta la divergenza e se entro max 5 barre si incrociano le mm ok...se no non prendere l'ordine....la vedo dura:) Grazie caro
Grazie! Buona giornata
Ciao Francesco! Grazie per l'indicatore che da tanto stavo cercando inutilmente di provare a creare! Ho un paio di domande da farti... L'ATR che hai inserito all'inizio serve a? :) non credo abbia a che fare con lo strumento...penso che serva a disegnare qualcosa sul grafico...esatto? Cosa intendi con shiftext? Valore 3? Sono il numero di barre che considera per verificare se c'è o no la divergenza? Pensavo che quell'istruzione fosse data dal minbarrange...... Confusion....;( Mi dai una mano?:) Grazie mille di tutto!!!
I am new to prorealtime and when I add this is wants to put it in a lower frame how do I get it to show up on my chart frame. Thanks for your help
1- Download attached file rsi-divergences-2.itf 2- Here is how to import indicator into your platform: https://www.prorealcode.com/import-export-prorealtime-code-platform/ 3- Here is how to add indicator to your chart https://www.prorealtime.com/en/help-manual/technical-analysis-indicators Here is how to show it on your char
Hello merci pour l'indicateur j'ai un message d'erreur Veuillez définir la variable suivante : rsipériod Veuillez définir la variable suivante :rsioverbought Veuillez définir la variable suivante :rsioversold Veuillez définir la variable suivante : minbarrange quel sont ces données et ou dois je les mettre? merci par avance
Ho provato ad inserire i segmenti per evidenziare le divergenze, ma al momento non sono riuscito ad individuare correttamente i punti, per cui i segmenti stessi mi venivano disegnati nei punti e con le inclinazioni sbagliate. Cmq, per disegnarli devi individuare i punti (x1, y1) e (x2, y2) che sono le coordinate dei due punti estremi del segmento. x1 dovrebbe essere la candela (il barindex) del minimo (o massimo) più vecchio e y1 il relativo valore di RSI. Allo stesso modo, x2 è la candela del secondo minimo (o massimo) più recente e y2 il relativo valore di RSI. In effetti i rispettivi valori di RSI (cioè y1 e y2) possono essere letti dalle variabili RSIMax1 e RSIMax2 (nel caso dei massimi); RSIMIn1 RSIMin2 nela caso dei minimi. x1 e x2 andrebbero letti dalla variabile "I" che rappresenta il barindex man mano che il ciclo for --> next viene scorso. Ci ho provato, ma le riche mi venivano disegnate tutte storte. Ci devo lavorare.
La logique centrale est correcte : ce code détecte bien les divergences RSI classiques et cachées. Les syntaxes
RSI[N](close),AverageTrueRange[N](close), les boucles et les instructions de dessin sont conformes à ProBuilder.Ce qu’il détecte correctement
Aux sommets :
Aux creux :
Les limites importantes
1. Il ne renvoie actuellement aucune valeur numérique
La dernière ligne est simplement :
Si c’est bien l’intégralité du code, il dessine des flèches et du texte, mais ne renvoie pas
+1,0ou–1. OrRETURNsert précisément à fournir la valeur exploitable de l’indicateur.Pour les alertes, il faudrait notamment initialiser :
puis mettre :
dans les deux divergences baissières, et :
dans les deux divergences haussières, puis terminer par :
2. Il est très restrictif
Un sommet RSI n’est accepté que s’il est supérieur à
RsiOverBought, et un creux seulement s’il est inférieur àRsiOverSold.Ainsi, si tes seuils sont 70 et 20, les deux pivots doivent se former dans ces zones extrêmes. Cela élimine beaucoup de divergences valables, mais peut aussi réduire les signaux faibles. Le RSI et ses divergences ne nécessitent pas obligatoirement une présence au-dessus de 70 ou sous 30/20.
3. Il ne compare que le précédent pivot RSI trouvé
Dès que la boucle trouve le précédent sommet ou creux RSI, elle exécute
BREAK, même si aucune divergence n’est constatée avec ce pivot. Elle ne recherche donc pas une divergence possible avec un pivot plus ancien.Cela réduit les faux signaux, mais peut aussi manquer certaines divergences longues.
4. Il utilise les pivots du RSI, pas les véritables pivots du prix
Il prend simplement le
High[1]ou leLow[1]correspondant au pivot RSI. Il ne vérifie pas explicitement que ce prix constitue lui aussi un sommet ou un creux structurel.C’est acceptable, mais moins rigoureux qu’une détection exigeant simultanément :
5. Les flèches sont dessinées une bougie après le pivot
Le pivot détecté se trouve sur la bougie
[1], mais la flèche est dessinée sur :Pour positionner la flèche exactement sur le pivot, il faudrait plutôt utiliser :
et, pour une divergence haussière :
Les fonctions de dessin utilisent bien
BarIndexpour la position horizontale.Verdict
Le calcul des quatre types de divergences est juste, mais ce code :
RETURNest réellement vide.Et en temps réel, la divergence peut encore apparaître puis disparaître pendant la bougie de confirmation ; à la clôture, elle devient beaucoup plus stable.