RSI Divergences finder

Category: Indicators By: gabri Created: April 19, 2017, 2:45 PM
April 19, 2017, 2:45 PM
Indicators
40 Comments

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

//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]
c2=a[4]<a[2] and a[3]<a[2] and a[1]<a[2] and a<a[2]

//finding the double bottom
if c1 then
 RefCloseDownNew=close[2]
 RefRSIDownNew=a[2]
 BarBullNew=barindex[2]
endif
if RefCloseDownNew<RefCloseDownOld and RefRSIDownNew>RefRSIDownOld then
 //double slash next line if you don't needed the mark on a different window
 bulldiv=1
 //entry price for long on price window // double slash next line if not needed
 DRAWSEGMENT(BarBullNew, highest[(BarBullnew-BarBullOld)](close[1]), BarBullNew+10, highest[(BarBullnew-BarBullOld)](close[1]))
 //entry price for long on RSI window // double slash next line if not needed
 DRAWSEGMENT(BarBullNew, highest[(BarBullnew- BarBullOld)](a[1]), BarBullNew+10, highest[(BarBullnew-BarBullOld)](a[1]))
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=-1
 //entry price for short on price window // double slash next line if not needed
 DRAWSEGMENT(BarBearNew, LOWEST[(BarBearnew-BarBearOld)](close[1]), BarBearNew+10,  LOWEST[(BarBearnew-BarBearOld)](close[1]))
 //entry price for short on RSI window // double slash next line if not needed
 DRAWSEGMENT(BarBearNew, LOWEST[(BarBearnew-BarBearOld)](a[1]), BarBearNew+10, LOWEST[(BarBearnew-BarBearOld)](a[1]))
else
 beardiv=0
endif

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

return bulldiv, beardiv

Download
Filename: Mio-divergenza-RSI.itf
Downloads: 660
gabri Master
Currently debugging life, so my bio is on hold. Check back after the next commit for an update.
Author’s Profile

Comments

Logo Logo
Loading...