1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
30 lines of Pine Script v5 from src/indicator/rsi.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.
rsi.pine
// RSI indicator
//
// Input configuration
// - sourceInput: close; the OHLC input for the RSI
// - lengthInput: 14; number of periods for the RSI
// - offsetInput: 0;
//
// Output:
// - RSI solid line
// - Overbought dotted line
// - Oversold dotted line
//@version=5
indicator(title="Relarive Strength Index", shorttitle="RSI with timeframe", overlay=true, timeframe="D", timeframe_gaps=true)
// Configurable input fields
float sourceInput = input.source(close, title="Source")
int lengthInput = input.int(14, minval=1, title="Length")
int offsetInput = input.int(title="Offset", defval=0, minval=-500, maxval=500)
// RSI is between 0 and 100
float rsi = ta.rsi(sourceInput, lengthInput)
// Plot RSI line
plot(rsi, color=color.blue, title="RSI", offset=offsetInput)
// Plot horizontal lines
hline(80, "Overbought", color=color.gray, linestyle=hline.style_dotted)
hline(20, "Oversold", color=color.gray, linestyle=hline.style_dotted)
Overview
Relarive Strength Index plots the RSI line directly on the price chart along with dotted horizontal lines marking overbought at 80 and oversold at 20. The main settings control the input source, calculation length, and plot offset for alignment. This is an overlay indicator designed for trend and momentum analysis on any chart timeframe.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Source
source
close
sourceInput
Length
int
14
lengthInput
Offset
int
0
offsetInput
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
The Adaptive RSI Moving Average (ARSIMA) is an overlay indicator that dynamically adjusts its smoothing factor based on the Relative Strength Index (RSI). When the RSI moves toward extreme overbought or oversold conditions, the smoothing factor increases to ma
This overlay indicator screens a pasted list of up to forty symbols and draws a table on the price chart. It classifies bullish or bearish setups from the percent change between the current candle and the candle 250 bars back, then shows RSI with a simple movi
This indicator plots trade entry and exit signals on the price chart by combining Bollinger Bands with optional filter conditions. It calculates standard Bollinger Bands along with RSI, Aroon, and moving average filters. Reversal signals trigger when price bre
This indicator plots three moving averages on the price chart alongside colored fills between the lines to visualize trend structure. Internally, it calculates a Stochastic RSI oscillator to detect oversold reversals. When the Stochastic %K line rises above 10
Mean Reversion Study is an indicator that identifies trade setups combining exponential moving averages, RSI extremes, and engulfing candlestick patterns. It highlights bullish setups when a bullish engulfing candle forms below the EMA while RSI is oversold, a
This overlay indicator marks call and put setups from EMAs, RSI, MACD, and a SPY volume ratio. A call needs higher highs, RSI above its minimum, rising MACD, above-average proxy volume, and a rising trend EMA; a put reverses those tests. Early markers use an E