Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- //Double RSI by Braconnot P.
- indicator(title="Double RSI + Bollinger Bands", shorttitle="Double RSIBB")
- src = input(close, title="Source")
- string TT1 = 'Oversold, overbought lines from center (50). For 70/30 set it to 20'
- string TT2 = 'Creates a linear center space between bands'
- lenRSIF = input.int(25, minval=1,title="Fast RSI")
- lenRSIS = input.int(100, minval=1,title="Slow RSI")
- rsiSmooth = input.int(4, minval=1, title="RSI Smoothing")
- tH = input.float(15, 'RSI OS OB', step=1,tooltip=TT1)
- rsiT = input.float(7, 'Bollinger spacer', step=1,tooltip=TT2)
- bLen = input.int(15, title="Bollinger Lenght")
- bMult = input.float(3, title="Bollinger Multiplier")
- rsiF = ta.sma(ta.rsi(src, lenRSIF), rsiSmooth)
- rsiS = ta.sma(ta.rsi(src, lenRSIS), rsiSmooth)
- [middle, upper, lower] = ta.bb(rsiS, bLen, bMult)
- uB=plot(upper + rsiT, color=color.new(#ffffff, 60))
- lB=plot(lower - rsiT, color=color.new(#ffffff, 60))
- fastRsiColor = rsiF > upper + rsiT and rsiF < 50 + tH ? color.rgb(228, 63, 51, 20) : rsiF <= lower - rsiT and rsiF > 50 - tH ? color.rgb(8, 170, 8, 20) : rsiF > tH + 50 ? color.rgb(255, 0, 0, 20) : rsiF < 50 - tH ? color.rgb(119, 255, 77, 20) : color.rgb(255, 243, 19, 20)
- fillRsiColorU= rsiF > upper + rsiT and rsiF < 50 + tH ? color.rgb(233, 85, 74, 40) : rsiF <= lower - rsiT and rsiF > 50 - tH ? color.rgb(8, 170, 8, 90) : rsiF > tH + 50 and rsiF > upper ? color.rgb(255, 0, 0,50) : rsiF < 50 - tH ? color.rgb(39, 206, 48,90) : color.rgb(190,190,190,100)
- fillRsiColorL = rsiF > upper + rsiT and rsiF < 50 + tH ? color.rgb(233, 84, 74, 90) : rsiF <= lower - rsiT and rsiF > 50 - tH ? color.rgb(8, 170, 8, 40) : rsiF > tH + 50 ? color.rgb(160, 17, 53,90) : rsiF < 50 - tH ? color.rgb(9, 255, 0, 42) : color.rgb(190,190,190,100)
- rsiFF=plot(rsiF, title='Fast RSI plot', color=fastRsiColor, linewidth=2)
- rsiSF=plot(rsiS, title= 'Slow RSI plot', color=color.rgb(248, 150, 65, 10), linewidth=3)
- midL=hline(50, title='Middle Line', color=color.rgb(255, 255, 255, 60), linestyle=hline.style_dashed, linewidth=1)
- oB=hline(50 +tH, title='OB Line', color=color.rgb(140, 45, 230, 40), linestyle=hline.style_solid, linewidth=1)
- oS=hline(50 -tH, title='OS Line', color=color.rgb(140, 45, 230, 40), linestyle=hline.style_solid, linewidth=1)
- fill(uB,lB, title='BG Fill', color=color.new(color.blue, 90))
- fill(rsiFF, uB, title='RSI Fill', color=fillRsiColorU)
- fill(lB,rsiFF, title='RSI Fill', color=fillRsiColorL)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement