Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © Magic-Charts
- //@version=4
- study("Basic RSI and Stoch")
- rsiSource = input(title="Source", type=input.source, defval=close)
- rsiLength = input(title="RSI Length", type=input.integer, defval=14)
- smoothK = input(title="K", type=input.integer, defval=5)
- smoothD = input(title="D", type=input.integer, defval=3)
- rsiValue = rsi(rsiSource, rsiLength)
- k = sma(stoch(rsiValue, rsiValue, rsiValue, rsiLength), smoothK)
- d = sma(k, smoothD)
- highLine = hline(70, title="RSI Overbought Line", color=color.gray, linestyle=hline.style_dashed)
- midLine = hline(50, title="RSI Mid Line", color=color.gray, linestyle=hline.style_dashed)
- lowLine = hline(30, title="RSI Oversold Line", color=color.gray, linestyle=hline.style_dashed)
- fill(highLine, lowLine, color=color.silver)
- rsiPlot = plot(rsiValue, title="RSI", color=color.black)
- kPlot = plot(k, title="K", color=#808080)
- dPlot = plot(d, title="D", color=#BEBEBE)
- fill(kPlot, dPlot, color=k >= d ? #FFFFFF : #696969)
Advertisement
Add Comment
Please, Sign In to add comment