Indicator · Pine Script v5 · Own pane

RSI

by trsdn

This indicator calculates the Relative Strength Index along with a 200-period simple moving average.

View on GitHub

GitHub stars6on the repository
Pine versionv5runs as is
Lines of code23
Settings4inputs
LicenceMIT
Last update5 days ago23 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

23 lines of Pine Script v5 from strategies/ai-rsi.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

ai-rsi.pine
// Source: TradingView Built-in Indicator (RSI)
// Attribution: Standard RSI implementation matching TradingView's built-in indicator
// Used as input for AI-powered strategy conversion

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

rsiLength = input.int(14, "RSI Length", minval=1)
smaLength = input.int(200, "SMA Length", minval=1)
overbought = input.int(70, "Overbought Level")
oversold = input.int(30, "Oversold Level")

rsiValue = ta.rsi(close, rsiLength)
smaValue = ta.sma(close, smaLength)

plot(rsiValue, color=color.purple, title="RSI")
hline(overbought, "Overbought", color=color.red, linestyle=hline.style_dotted)
hline(oversold, "Oversold", color=color.green, linestyle=hline.style_dotted)

Additional instructions:
- This strategy uses RSI as a mean-reversion signal FILTERED by trend direction. Only buy oversold dips in an uptrend.
- The 200-period SMA acts as a trend filter — no entries when price is below it.
- The strategy enters/exits on the next candle open after the condition is met.

Overview

RSI plots the RSI oscillator line alongside horizontal reference levels for overbought and oversold thresholds in a separate pane below the main price chart. Configurable inputs allow adjustments to the RSI calculation period, SMA length, and threshold levels. As a pure indicator implementation designed for conversion into automated strategies, it does not display the calculated moving average, generate trade signals, or include position management rules.

Details

Published by

trsdn on GitHub

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Oscillators & momentum, Moving averages, Mean reversion

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

ai-scrumalgorithmic-tradingbacktestingbitcoinbollinger-bandscryptopine-scriptpythonquantitative-financestrategy

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
RSI Lengthint14rsiLength
SMA Lengthint200smaLength
Overbought Levelint70overbought
Oversold Levelint30oversold
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.

Similar Pine Scripts

114 stars

Calculates normalized reversal metrics across up to ten Forex currency pairs using user-selected moving average methods, including HarmonicMA, EMA, SMA, or WMA. The indicator identifies overbought, oversold, and mean-crossing conditions using a configurable th

Indicator v4 Screeners & dashboardsMean reversion
Updated 1 year ago · None stated GitHub repository of Multi-Pair Trend Reversal Widget

MACD x RSI Study

by jerryinyang
5 stars

This indicator combines MACD and RSI to generate pullback signals on forex pairs. It plots MACD line, signal line and histogram alongside RSI and Wave Trend oscillator. Higher-timeframe MACD provides trend bias while RSI identifies overbought and oversold zone

Indicator v4 Oscillators & momentumMoving averages
Updated 2 years ago · None stated GitHub repository of MACD x RSI Study

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

Indicator v4 Volatility & bandsOscillators & momentum
Updated 2 months ago · None stated GitHub repository of Bollinger Bands Winner IND [Alorse]
285 stars

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

Indicator v4 Mean reversionCandlestick patterns
Updated 3 years ago · None stated GitHub repository of Mean Reversion Study

Antigravity Elite

by eltonaguiar
4 stars

Antigravity Elite is an overlay indicator that screens price with seven selectable components: Mercury Fear, Connors RSI-2, volatility-spike reversal, EMA stack, Supertrend, multi-sigma bands, and an optional funding proxy. Auto-Detect chooses one method, whil

Indicator v6 Oscillators & momentumMoving averages
Updated today · None stated GitHub repository of Antigravity Elite

RSI Bounce

by blackcat1402
3 stars

RSI Bounce calculates custom Relative Strength Index levels scaled back onto price, creating nine price-equivalent RSI band series centered around a median RSI baseline. It combines short-term RSI extreme checks with customized MACD signal line crossovers to i

Indicator v4 Oscillators & momentumMoving averages
Updated 5 years ago · MIT GitHub repository of RSI Bounce

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers