OPEN-SOURCE SCRIPT

RSI

//version=5
indicator("RSI", overlay = false)

// Input for RSI period
rsiLength = input(14, title = "RSI Period")

// Calculate RSI
rsiValue = ta.rsi(close, rsiLength)

// Overbought and oversold levels
overbought = 70
oversold = 30

// Plot RSI
plot(rsiValue, title = "RSI", color = color.blue, linewidth = 2)

// Plot overbought and oversold lines
hline(overbought, "Overbought", color = color.red)
hline(oversold, "Oversold", color = color.green)

// Fill the overbought and oversold zones with color
bgcolor(rsiValue > overbought ? color.red : rsiValue < oversold ? color.green : na, transp = 90)
Bands and ChannelsBreadth IndicatorsCandlestick analysis

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 publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer