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/
- //@version=4
- study(title="Relative Strength Index", shorttitle="RSI", format=format.price, precision=2, resolution="")
- len = input(14, minval=1, title="Length")
- src = input(close, "Source", type = input.source)
- up = rma(max(change(src), 0), len)
- down = rma(-min(change(src), 0), len)
- rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
- plot(rsi, "RSI", color=#ffffff)
- band1 = hline(70, "Upper Band", color=#ffffff)
- bandm = hline(50, "Middle Band", color=color.new(#ffffff, 60))
- band0 = hline(30, "Lower Band", color=#ffffff)
- band4 = hline(80, "Upper Band", color=#ffffff)
- band3 = hline(60, "Middle Band", color=color.new(#ffffff, 60))
- band2 = hline(20, "Lower Band", color=#ffffff)
- fill(band1, band0, color=color.rgb(126, 87, 194, 90), title="Background")
Advertisement
Add Comment
Please, Sign In to add comment