Strategy · Pine Script v4 · On the chart

RSI Overbought Oversold

by LucidDion

This strategy plots RSI and Bollinger Bands on the price chart.

View on GitHub

GitHub stars3on the repository
Pine versionv4older, still runs
Lines of code16
Settings0inputs
LicenceMIT
Last update1 year ago6 Jun 2025

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 strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

16 lines of Pine Script v4 from PineWealth/Resources/PineScript.txt, published under MIT. Keep the author's credit and licence lines when you reuse it.

PineScript.txt
//@version=4
strategy("RSI Overbought/Oversold", overlay=true)

x = 20
rsi = ta.rsi(close, 14)
diff = close - open
diffInd = ta.rsi(close, 14) - ta.rsi(close, 4)
[middle, upper, lower] = ta.bb(close, 20, 20)

if (rsi > 70)
    strategy.entry("Short", strategy.short)
    x++

if (rsi < 30)
    strategy.entry("Long", strategy.long)
    x--

Overview

RSI Overbought Oversold calculates the 14-period RSI and 4-period RSI to detect overbought and oversold conditions. The strategy enters short positions when the RSI crosses above 70 and long positions when it falls below 30. No stop loss or take profit is applied and there are no user inputs to adjust. The script draws signals directly on the price chart.

Details

Published by

LucidDion on GitHub

Type

Strategy, Pine Script v4

Draws

On the price chart

Category

Oscillators & momentum, Support & resistance, Mean reversion

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • The strategy enters trades without a stop loss
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

TESLA-BestPosition

by theteelek
1 stars

TESLA-BestPosition is a long-only dollar-cost averaging strategy that combines custom Relative Strength Index levels with smoothed highest-high and lowest-low channels. It calculates 10-period exponential moving averages of highest highs and lowest lows over a

Strategy v6 Mean reversionOscillators & momentum
Updated 1 year ago · None stated GitHub repository of TESLA-BestPosition
330 stars

Alert BB + RSI [Alorse] is a multi-symbol mean-reversion strategy designed for cryptocurrency trading. It evaluates Bollinger Bands and the Relative Strength Index (RSI) across up to 20 user-defined ticker symbols simultaneously. The strategy enters long posit

Strategy v4 Oscillators & momentumVolatility & bands
Updated 2 months ago · None stated GitHub repository of Alert BB + RSI [Alorse]
285 stars

Mean Reversion Strategy is an overlay strategy that identifies pullbacks using a long-term EMA, RSI, and candlestick patterns. It generates long signals when a bullish engulfing candle forms below the EMA while RSI is oversold, and short signals when a bearish

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

This strategy draws on the price chart and combines Stochastic RSI, the Money Flow Index, and an exponential moving average to open long or short trades. Longs use the lower oscillator thresholds and shorts use the upper ones, with direction limited to longs,

Strategy v5 Oscillators & momentumMoving averages Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of 3 Indicator Strategy (StochRSI, MFI & EMA) With Safety Orders

More strategys

Trade Your Charts With a Regulated Broker

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

Compare brokers