Pine Library · 657 open-source scripts

Free Mean Reversion Pine Scripts

Open-source Pine scripts that bet on a stretched price returning to its average: band fades, oscillator extremes and statistical tools.

Pine scripts657
Code shown here317open licence
Updated in a year411
No repaint flag586

About Mean reversion Scripts

Mean reversion assumes that a price far from its average tends to come back. Scripts measure "far" with bands, z-scores or oscillator readings and signal a fade of the move.

The approach works in ranges and suffers in strong trends, where a stretched price can keep stretching. Look for a trend filter or a firm stop in any mean reversion strategy.

71 of these 657 scripts are marked Repaints, or read higher-timeframe data with lookahead on.

Before You Use One

Mean reversion: Indicators, Strategies and Libraries

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
257 stars

This indicator plots auto trade signals for E-mini S&P 500 futures on the price chart. It computes an EMA200 filter along with day ETH RTH session levels and percentage-based entry zones. Signals trigger CALL or PUT cases when price crosses defined thresholds

Indicator v6 TrendSupport & resistance
Updated 6 weeks ago · None stated GitHub repository of Auto Trade Futures ES
147 stars

This indicator combines Bollinger Bands, RSI, Stochastic RSI, and volume spike detection to identify mean-reversion conditions during range-bound market regimes. It calculates Bollinger Band width to identify low-volatility states and triggers buy or sell sign

Indicator v5 Oscillators & momentumVolatility & bands
Updated 6 weeks ago · MIT GitHub repository of BTC Dec 2025 — Range + Gamma Flush

This strategy builds a spot grid between user-set high and low prices and draws it on the price chart. It splits that range into ten levels and places up to five long limit orders at the lower levels, sizing each from current equity. Orders already below price

Strategy v6 Support & resistanceMean reversion Repaints
Updated 6 weeks ago · None stated GitHub repository of Grid Spot Trading Algorithm [The Quant Science]
55 stars

This Pine Script indicator overlays institutional liquidity levels on the price chart. It identifies order block levels using pivot highs and lows, then draws mean reversion lines from the 20 and 50 period simple moving averages, a volatility range midpoint pr

Indicator v6 Support & resistanceSMC / ICT / price action Repaints
Updated 6 months ago · Apache-2.0 GitHub repository of AAPL Institutional Liquidity Grid

Peak Reversal v3

by Zettt
43 stars

Peak Reversal v3 identifies potential mean-reversion points by plotting configurable Keltner Channels alongside a squeeze detector directly on the price chart. It detects momentum extremes when candles cross or trade completely outside the inner or outer chann

Indicator v6 Mean reversionVolatility & bands
Updated 1 year ago · None stated GitHub repository of Peak Reversal v3

3hr Stoch

by benso87
24 stars

3hr Stoch is a short-only trading strategy based on a smoothed Stochastic Oscillator. It calculates the %K and %D lines using configurable period and smoothing settings. The strategy enters a short position when the %K line crosses below the %D line while drop

Strategy v5 Oscillators & momentumMean reversion
Updated 4 years ago · MPL-2.0 GitHub repository of 3hr Stoch

Kalman Percentile Bands

by NQ-stats-MX
15 stars

Kalman Percentile Bands plots a volatility-adaptive Kalman mean along with three empirical percentile bands on each side of the price chart. It calculates a local-level Kalman filter as the fair value mean, normalizes price deviations by an EWMA of volatility,

Indicator v6 Mean reversionVolatility & bands
Updated 2 weeks ago · MIT GitHub repository of Kalman Percentile Bands

Markov Strategy

by Rohanom
9 stars

Markov Strategy is a mean-reversion quantitative strategy inspired by streak-based Markov chain analysis. Applied directly to the price chart, it monitors price action for consecutive downward closes. The strategy enters a long position after detecting six con

Strategy v5 Mean reversionCandlestick patterns
Updated 1 year ago · MIT GitHub repository of Markov Strategy

BB strategy Production

by satheshshiva
8 stars

This strategy plots Bollinger Bands on the price chart using a simple moving average and a standard-deviation multiplier. It enters long when close crosses above the lower band while still below the basis, and short when close crosses under the upper band whil

Strategy v5 Volatility & bandsMean reversion
Updated 3 years ago · None stated GitHub repository of BB strategy Production

Arrows Off BB

by lunarticktrading
7 stars

This indicator plots standard Bollinger Bands and identifies potential mean-reversion setup signals directly on the main price chart. A bullish signal triggers when a bullish candlestick follows a bearish candlestick while both consecutive bars' lows drop belo

Indicator v6 Volatility & bandsMean reversion
Updated 2 weeks ago · None stated GitHub repository of Arrows Off BB
7 stars

This strategy plots a simple moving average basis and upper and lower Bollinger bands on the price chart, with a fill between the bands. It also calculates RSI. It opens one long trade when RSI is above 25, price is at or below the lower band, and no position

Strategy v5 Volatility & bandsOscillators & momentum
Updated 4 years ago · GPL-3.0 GitHub repository of Bollinger Bands Strategy

MultiPeriodOverBS

by wanjo-tech
6 stars

This strategy calculates volume-weighted Relative Strength Index (RSI) values across multiple timeframes, specifically 15-minute and daily periods. It averages the resulting short- and long-term RSIs into an oscillator to identify extreme overbought and overso

Strategy v5 Oscillators & momentumMean reversion
Updated 2 years ago · None stated GitHub repository of MultiPeriodOverBS
5 stars

This strategy enters one long trade when the bar low comes within a set point tolerance of the prior day's low and the close finishes above that level. Entries are allowed only inside a UTC session and are blocked after a Friday cutoff hour. It stays flat unti

Strategy v5 Support & resistanceMean reversion Repaints
Updated 5 months ago · MIT GitHub repository of PDL — Prior Day Level Retest (Bull)
5 stars

This indicator implements Tom DeMark's TD Sequential methodology on the price chart to detect trend exhaustion and reversal zones. It counts the Setup phase of nine consecutive bars comparing closes to four bars prior, tracks setup perfection, and advances int

Indicator v6 TrendMean reversion
Updated 1 year ago · None stated GitHub repository of TD Sequential - Official DeMark
5 stars

Greeffer's Scalping Indicator overlays higher-timeframe exponential moving averages, Bollinger Bands, and Donchian channels on the price chart. It flags a long when price touches the lower Donchian and lower band while the faster averages are not stacked beari

Indicator v5 Moving averagesVolatility & bands
Updated 4 years ago · None stated GitHub repository of Greeffer's Scalping Indicator
4 stars

Lucid 100K is an automated evaluation strategy tailored for micro futures contracts such as MES, MGC, and MNQ on lower timeframes. It operates a two-phase state machine that moves from an initial risk-averse lock-in phase to an expanded payout phase once targe

Strategy v6 TrendMean reversion
Updated 2 days ago · None stated GitHub repository of Lucid 100K (MES/MGC/MNQ)

ADX Trend Filter

by latentwill
4 stars

This strategy enters long when a series labeled ADX is above a threshold and RSI is below 40, and enters short when that series is above the threshold and RSI is above 60. Both series are calculated with the RSI function, so the trend filter is not a true ADX.

Strategy v5 TrendOscillators & momentum
Updated 7 days ago · None stated GitHub repository of ADX Trend Filter

Bollinger Bands

by bfoura
4 stars

This indicator calculates standard Bollinger Bands using a simple moving average and standard deviation multiplier. Instead of plotting continuous band lines, it evaluates whether the current price trades within a configurable threshold distance of the band bo

Indicator v5 Volatility & bandsMean reversion
Updated 4 years ago · None stated GitHub repository of Bollinger Bands

Bigbaldy RSI for DCA

by bigbaldy1128
4 stars

This strategy simulates Dollar Cost Averaging (DCA) trading bot behavior on the chart. It triggers an initial entry when the RSI drops below a specified oversold limit and price is under a maximum price cap. As price falls, it calculates simulated safety order

Strategy v4 Oscillators & momentumMean reversion
Updated 5 years ago · None stated GitHub repository of Bigbaldy RSI for DCA
3 stars

This strategy plots Bollinger Bands on the price chart and enters long only when flat. It buys on a strong bullish close above the middle band or on a small-body pullback that tags the middle band with a long lower wick. The stop sits below the signal bar by a

Strategy v5 Volatility & bandsBreakout
Updated 2 days ago · None stated GitHub repository of H4 布林ATR型態多單策略

Medallion Cipher

by ricksimpsontrading
3 stars

Medallion Cipher is a separate-pane indicator that combines a four-state hidden Markov model (bull, bear, range, and crisis) with weighted confluence signals. It can include mean reversion, trend, session timing, pattern matching, Hurst exponent, Shannon entro

Indicator v6 AI / machine learningMean reversion
Updated 9 days ago · None stated GitHub repository of Medallion Cipher

Mean Reversion T

by Ye-Yu-Mo
3 stars

Mean Reversion T is a dual-engine intraday indicator designed for 15-minute charts to detect mean-reversion and shock-reversal trading opportunities. It calculates Z-score price deviations from a moving average mean alongside regime scores across 15-minute and

Indicator v6 Mean reversionMoving averages Repaints
Updated 2 months ago · MPL-2.0 GitHub repository of Mean Reversion T
3 stars

The Buy/Sell Position Strategy combines a long-term Exponential Moving Average (EMA) with a short-term Relative Strength Index (RSI) to capture pullbacks in an uptrend. It enters a long position on the price chart when the price is above the EMA filter and the

Strategy v5 TrendOscillators & momentum
Updated 4 months ago · None stated GitHub repository of Buy/Sell Position Strategy
3 stars

This strategy calculates standard Bollinger Bands and Average True Range to implement a basic mean-reversion system. It opens long positions when price drops below the lower band and short positions when price pierces above the upper band. Open trades are exit

Strategy v5 Mean reversionVolatility & bands
Updated 7 months ago · MIT GitHub repository of Bollinger Band Mean Reversion

DP2

by grinay
3 stars

DP2 is a price-chart strategy that looks for a short dump between the chosen from and to prices, optionally requiring a break of a multi-day low while ignoring moves larger than a dump cap. It can enter through classic, two-close, break-and-retest, ATR-stop, a

Strategy v6 Mean reversionVolatility & bands
Updated 8 months ago · MIT GitHub repository of DP2

Stella's Bollinger Bands

by stella-entry
3 stars

This strategy plots Bollinger Bands on the price chart and trades a long-only mean-reversion idea. It enters when the close is below the lower band, or when the low touches that band if Touch mode is selected, and only while flat. With the opposite-band exit e

Strategy v6 Volatility & bandsMean reversion
Updated 8 months ago · MIT GitHub repository of Stella's Bollinger Bands
3 stars

This strategy plots RSI and Bollinger Bands on the price chart. It 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 be

Strategy v4 Oscillators & momentumSupport & resistance
Updated 1 year ago · MIT GitHub repository of RSI Overbought Oversold
3 stars

This strategy opens a long base order and preplaces up to seven limit safety orders below entry, increasing size by a volume scale as price falls. It recalculates an average entry and closes the whole position when price reaches a take-profit percentage above

Strategy v5 Mean reversionSupport & resistance
Updated 2 years ago · Custom licence GitHub repository of Fibonacci Martingale Strategy
3 stars

This strategy plots Bollinger bands and a simple moving average on the price chart. It opens a short when price crosses above the upper band while below the average, and a long when price crosses below the lower band while above the average. Entries are allowe

Strategy v5 Volatility & bandsMoving averages
Updated 2 years ago · None stated GitHub repository of 周末布林带策略

BB RSI Strategy

by infinityhao
3 stars

BB RSI Strategy combines Bollinger Bands, RSI, and multiple simple moving averages directly on the main price chart. It enters long positions when price drops below the lower Bollinger Band while RSI is below a set limit, and enters short positions when price

Strategy v4 Volatility & bandsOscillators & momentum Repaints
Updated 5 years ago · None stated GitHub repository of BB RSI Strategy
2 stars

ATR% Multiple from MA measures price extension relative to a moving average, expressed in multiples of Average True Range percentage. It calculates ATR as a percentage of close, evaluates the percentage distance between the price and its moving average, and no

Indicator v6 Moving averagesVolatility & bands
Updated 3 months ago · Apache-2.0 GitHub repository of ATR% Multiple from MA

This indicator measures how far price sits from a simple moving average, expressed as a percentage, then smooths that difference and plots it as an area in a separate pane. Green marks a positive deviation and red a negative one, so the series acts as a direct

Indicator v6 Moving averagesMean reversion Repaints
Updated 8 months ago · MIT GitHub repository of Grid Bot [Direction plugin] Price Deviation [psyll]

ATR Reversion System

by Web3Degenerate
2 stars

The ATR Reversion System is a long-only mean-reversion strategy that plots ATR bands around a short-term EMA (20) and a long-term EMA (200) filter on the price chart. It signals entries by checking if the close is below the bottom ATR band and above the long E

Strategy v5 Mean reversionMoving averages
Updated 2 years ago · None stated GitHub repository of ATR Reversion System

VWAP Percent Distance

by francolla
2 stars

VWAP Percent Distance calculates and plots the relative percentage difference between the closing price and the Volume Weighted Average Price (VWAP). Designed as a mean-reversion tool, it helps traders measure how far price has stretched from VWAP in percentag

Indicator v5 Mean reversionMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of VWAP Percent Distance
2 stars

This strategy builds a spot grid on the price chart from a user-set upper price and a percentage spacing. It calculates ten descending levels, plots the upper and lower bounds, and allows up to ten stacked entries sized as a percentage of equity. Orders are pr

Strategy v5 Support & resistanceMean reversion
Updated 3 years ago · None stated GitHub repository of 그리드현물매매전략

DCA Bot Backtest

by Metzenas
2 stars

A dollar-cost averaging strategy template designed to simulate algorithmic DCA trading bots. It initiates a base order immediately or based on indicator inputs, then scales into positions with safety orders as price deviates against the entry, applying configu

Strategy v4 Mean reversion
Updated 5 years ago · None stated GitHub repository of DCA Bot Backtest
1 stars

A price-chart indicator for leveraged turbo and mini products on stocks, built on the daily 14-period RSI. It computes the price at which today's close would take the daily RSI below the oversold level, using the previous day's averages, and works on intraday

Indicator v6 Mean reversionOscillators & momentum Repaints
Updated yesterday · None stated GitHub repository of RSI 30 Turbo Levels
1 stars

An overlay for same-day expiry credit spreads on the S&P 500 index that reproduces signals from the author's separate backend. It watches an opening observation window, then flags directional entries when stochastic, RSI, trend, a VWAP alignment gate and a con

Indicator v6 Sessions & timeMean reversion
Updated yesterday · None stated GitHub repository of ZeroDTE Backend Mirror

Dip2Green PRO

by mcgary6567-lab
1 stars

A Pine v6 indicator that looks for a dip followed by confirming candles. A long setup is an oversold red flush followed by green candles, and a short setup is an overbought green move followed by red candles. A composite score from RSI depth, range against ATR

Indicator v6 Mean reversionOscillators & momentum
Updated yesterday · None stated GitHub repository of Dip2Green PRO
1 stars

A long-only dip signal indicator that combines a 200-bar Bollinger Band filter with MACD crossovers. A buy marker appears when price has touched the lower band and, by default, still closes below the midline, then a standard or Impulse MACD crossover confirms.

Indicator v6 Mean reversionOscillators & momentum
Updated 2 days ago · None stated GitHub repository of Dip Mafia BB(200) Gate + MACD

BB StochRSI ADX Scalper

by surendra2304
1 stars

A mean reversion strategy that buys when price dips below the lower Bollinger Band while Stochastic RSI is oversold and crosses up, and sells short on the mirror setup at the upper band. Entries are skipped when ADX is above a maximum, to avoid strong trends.

Strategy v5 Mean reversionScalping
Updated 2 days ago · None stated GitHub repository of BB StochRSI ADX Scalper

ES1! Long 1D MA200 MA5

by luifertorres
1 stars

A long-only daily strategy for E-mini S&P futures. It enters long when the 200-period SMA is rising, the candle is bearish and the whole bar sits below the 5-period SMA, and it closes the position when price closes above the 5-period SMA. Size is a fixed one c

Strategy v6 Mean reversionMoving averages
Updated 5 days ago · MIT GitHub repository of ES1! Long 1D MA200 MA5

A long-only strategy for short-term crypto trading that combines Bollinger Bands, RSI, a 9-period EMA, a 21-period SMA and a Fibonacci window covering about ten minutes of bars. It sizes positions as a percentage of equity and can require a minimum gain before

Strategy v6 ScalpingSessions & time
Updated 7 days ago · None stated GitHub repository of Crypto Long 10m Scalper BB RSI EMA Fib

Sequential Countdown

by allanninal
1 stars

Sequential Countdown is an overlay indicator that writes a 9-13 sequential count on the price chart. It plots buy setup numbers below bars and sell numbers above them, marking a perfected nine differently from an unperfected nine, then draws countdown numbers

Indicator v6 Oscillators & momentumMean reversion
Updated 7 days ago · Custom licence GitHub repository of Sequential Countdown

More Pine Script Categories

Browse the whole Pine Library

Related on ForexR

Third-party code. ForexR lists open-source Pine scripts from GitHub; it did not write, test or endorse them, and their summaries are generated automatically from each script's code and README. Indicators describe the past, and a strategy's backtest can look better than live trading. Check a script on a demo account before you rely on it. CFDs and leveraged forex are complex instruments with a high risk of losing money rapidly.

Learn to Use Pine Scripts

Free, plain-English guides: add a script to TradingView, read what it does, test it and avoid the common traps.

  1. 1Using this librarySearch, filters, licences and what the badges mean.
  2. 2Add a script to TradingViewCopy, paste into the Pine Editor, save and add to chart.
  3. 3Indicators, strategies and librariesWhat each type does and how to tell them apart.
  4. 4Spot a script that repaintsWhy some signals change after the bar closes.
  5. 5Backtest a strategyStrategy Tester settings that keep results honest.
  6. 6Send alerts to MT4 or MT5From a TradingView alert to an order in MetaTrader.

Trade Your Charts With a Regulated Broker

Compare regulated brokers on platforms, spreads, minimum deposit and leverage.

Compare brokers