RicardoSantos

[RS]RSI Divergence V4

EXPERIMENTAL: experimental setup, hard coded rsi lengths, hardcoded level limits, testing new aproach to the reflections, added extra rsi's
main rsi's length 13/55, smooth option will affect all rsi's
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?
study(title="RSI Divergence V4", shorttitle="RSID.V4", overlay=false)
buylimit1 = 10
buylimit2 = 20
buylimit3 = 30
buylimit4 = 40
selllimit1 = 90
selllimit2 = 80
selllimit3 = 70
selllimit4 = 60
smooth = input(4)
src = sma(input(type=source, defval=close), smooth)

rsi1 = rsi(src, 5)
rsi2 = rsi(src, 8)
rsi3 = rsi(src, 13)
rsi4 = rsi(src, 21)
rsi5 = rsi(src, 34)
rsi6 = rsi(src, 55)

rcolor1 = rsi1 >= rsi2 ? silver : gray
rcolor2 = rsi2 >= rsi3 ? silver : gray
rcolor3 = rsi3 >= rsi4 ? silver : gray
rcolor4 = rsi4 >= rsi5 ? silver : gray
rcolor5 = rsi5 >= rsi6 ? silver : gray
plot(rsi1, color=rcolor1)
plot(rsi2, color=rcolor2)
plot(rsi3, color=black)
plot(rsi4, color=rcolor4)
plot(rsi5, color=rcolor5)
plot(rsi6, color=black, linewidth=2)
//  ||-------------------------------------------------------------------------------------
dif1 = rsi6-rsi1
dif2 = rsi5-rsi2
dif3 = rsi4-rsi3

topdiv1 = dif1 < 0 ? selllimit4 - dif1 : selllimit4
topdiv2 = dif2 < 0 ? selllimit3 - dif2 : selllimit3
topdiv3 = dif3 < 0 ? selllimit2 - dif3 : selllimit2
botdiv1 = dif1 > 0 ? buylimit4 - dif1 : buylimit4
botdiv2 = dif2 > 0 ? buylimit3 - dif2 : buylimit3
botdiv3 = dif3 > 0 ? buylimit2 - dif3 : buylimit2

plot(topdiv1, style=area, color=teal, transp=80, histbase=selllimit4)
plot(topdiv2, style=area, color=teal, transp=80, histbase=selllimit3)
plot(topdiv3, style=area, color=teal, transp=80, histbase=selllimit2)
plot(botdiv1, style=area, color=teal, transp=80, histbase=buylimit4)
plot(botdiv2, style=area, color=teal, transp=80, histbase=buylimit3)
plot(botdiv3, style=area, color=teal, transp=80, histbase=buylimit2)
//----------------------------------------------------------
hidelimits = input(true)
hline(0, color=black)
plot(hidelimits ? na : buylimit1, color=green)
plot(hidelimits ? na : buylimit2, color=lime)
plot(hidelimits ? na : buylimit3, color=olive)
plot(hidelimits ? na : buylimit4, color=teal)
hline(50, color=black)
plot(hidelimits ? na : selllimit1, color=maroon)
plot(hidelimits ? na : selllimit2, color=red)
plot(hidelimits ? na : selllimit3, color=orange)
plot(hidelimits ? na : selllimit4, color=teal)
hline(100, color=black)

Comments

Nice one Ricardo !
+1 Reply
thx :)
Reply
anacondabitch RicardoSantos
@RicardoSantos, can you explain this? looks really interesting
Reply
anacondabitch anacondabitch
@anacondabitch, i've been using your V0 with td works great
Reply
RicardoSantos anacondabitch
@anacondabitch, mainly its a visual tool to identify divergence at multiple "Timeframes" / "Wavelengths" (naming open to interpretation) its easy to detect when price is at a correction/pullback(ex:. longer rsi's under 50 and shorter rsi's spike upwards)
Reply
anacondabitch RicardoSantos
@RicardoSantos, all right thx ... btw you have many variations of the same indicator which version is good for highly volatile market like btc?
Reply
RicardoSantos anacondabitch
@anacondabitch, just use what you feel is better, they are just variant of the same
Reply
anacondabitch RicardoSantos
@RicardoSantos, thx again .... your indicator works better with 254 min on btc
Reply
Thanks Ricardo, looks great. Are you able to provide a little more detail please on how to read / interpret the indicator for newer people like me? Thanks!
Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter