Pine Library · 657 open-source scripts

Free Mean Reversion Pine Scripts (page 11)

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

Mean reversion: Indicators, Strategies and Libraries

Mean Reversion Bollinger

by pineforge-4pass
1 stars

This strategy combines Bollinger Bands and the Relative Strength Index (RSI) to execute mean-reversion trades directly on the main price chart. It opens long positions when price drops below the lower band with an oversold RSI reading, and opens short position

Strategy v6 Oscillators & momentumVolatility & bands
Updated 6 days ago · Apache-2.0 GitHub repository of Mean Reversion Bollinger

NY

by wynnforthework
2 stars

This strategy combines a fast Hull Moving Average with Bollinger Bands to generate mean-reversion signals. It opens a long position when the calculated Hull Moving Average crosses above the lower Bollinger Band, and opens a short position when it crosses below

Strategy v5 Moving averagesVolatility & bands
Updated 1 year ago · None stated GitHub repository of NY

Cointegration

by mihakralj
99 stars

Calculates the statistical cointegration between the current chart instrument and a user-selected secondary ticker using the Engle-Granger method. It evaluates the stationarity of the regression residuals and plots the Augmented Dickey-Fuller test statistic in

Indicator v6 Mean reversion
Updated 4 weeks ago · Apache-2.0 GitHub repository of Cointegration
3 stars

This indicator tracks the low of day and high of day during the specified RTH session hours in the New York timezone. It calculates the high at the current low of day (lod_h) and the low at the current high of day (hod_l). Horizontal lines are drawn at these l

Indicator v5 Sessions & timeSupport & resistance
Updated 5 months ago · None stated GitHub repository of Day Trading Reversal System
1 stars

An overlay indicator that classifies the market into regimes such as trend, chop and squeeze using ADX, range efficiency, relative volume, ATR expansion and VWAP slope. It also measures how far price is from VWAP and an EMA to flag rich, cheap or extreme readi

Indicator v6 Volatility & bandsMean reversion
Updated 7 days ago · GPL-3.0 GitHub repository of Regime Engine + TCO Gatekeeper
1 stars

An indicator component that calculates 20-period Bollinger Bands with a 2.0 deviation multiplier and plots the basis, upper and lower bands with a shaded fill. It also converts band contact into a weighted score: a score when the close is below the lower band

Indicator v5 Volatility & bandsMean reversion
Updated 1 year ago · None stated GitHub repository of Neural Network Sub 31 Bollinger

Flawless Victory Strategy is a mean-reversion overlay that combines Bollinger Bands, RSI, and Money Flow Index (MFI) to identify trade entries and exits. The script provides three preset configuration modes: Version 1 executes signals without target exits, whi

Strategy v4 Oscillators & momentumVolatility & bands
Updated 2 months ago · None stated GitHub repository of Flawless Victory Strategy [Alorse]

VWMA_WF

by avatar-lavventura
2 stars

VWMA_WF plots a 24-period volume-weighted moving average of the 60-minute hlc3 price on the chart, plus percentage offset bands. It draws a long label when price is at or below the lower band and a down fractal is confirmed, and it sends a short alert when pri

Indicator v4 Moving averagesVolume Repaints
Updated 7 months ago · None stated GitHub repository of VWMA_WF

FTB Strategy

by Web3Degenerate
2 stars

The FTB Strategy is a short-only overlay strategy targeting EURUSD during the European session from 0200-0700. It enters short positions when filters confirm RSI overbought, a bullish prior bar close, or a high price level within lookback bars, combined with a

Strategy v5 Mean reversionSessions & time
Updated 2 years ago · None stated GitHub repository of FTB Strategy

This indicator creates a heatmap table in a separate pane showing cointegration strength between a user-defined list of symbols. It calculates aligned returns from sum and difference spreads for each symbol pair, then derives a cointegration proxy as the resid

Indicator v6 Mean reversionScreeners & dashboards Repaints

ATR Mean Reversion

by hasnocool
106 stars

This strategy identifies mean reversion opportunities using ATR bands on the price chart. It enters long positions when price touches the lower band (open minus ATR) with no open position and within the set time filter. Positions exit on the upper band breach,

Strategy v5 Mean reversionVolatility & bands
Updated 2 years ago · GPL-3.0 GitHub repository of ATR Mean Reversion
47 stars

This indicator applies the hyperbolic tangent to a chosen source series and plots the result in a separate pane. It centers the transform on a 200-bar simple moving average of that source, multiplies the deviation by a steepness factor, and maps the output int

Indicator v6 Moving averagesMean reversion
Updated 8 months ago · MIT GitHub repository of Hyperbolic Tangent (TANH)
2 stars

The SVIX Bollinger Bands Strategy V2 uses Heikin-Ashi price calculations to plot customized Bollinger Bands and Keltner Channels directly on the price chart. It triggers a long entry when the Heikin-Ashi close crosses above the lower Bollinger Band. The strate

Strategy v5 Volatility & bandsMean reversion
Updated 1 year ago · None stated GitHub repository of SVIX Bollinger Bands Strategy V2
1 stars

Draws a moving price level that bounces between the highest high and lowest low of a rolling window, 50 bars by default, with the range midline and a mirrored close line on the price chart. Buy and sell labels appear when price crosses the mirrored line or the

Indicator v5 Mean reversionOscillators & momentum
Updated 7 weeks ago · None stated GitHub repository of Auto Mirror Reversal Signals

This strategy plots multi-timeframe Bollinger Bands on the price chart and trades mean reversion around them. It enters long when the close is below the higher-timeframe lower band and, if enabled, short when the close is above the upper band. An optional high

Strategy v4 Volatility & bandsMean reversion Repaints
Updated 2 months ago · None stated GitHub repository of MTF Bollindger Bands Strategy [Alorse]
9 stars

This indicator plots an anchored MIDAS support and resistance curve from launch-anchored volume-weighted price on the price chart. It adds two configurable volume-weighted standard-deviation, ATR, or hybrid bands and a topfinder or bottomfinder accelerated exh

Indicator v6 Mean reversionSupport & resistance Repaints
Updated 2 days ago · MIT GitHub repository of MIDAS 2.0 [WavesUnchained]
330 stars

This strategy plots Bollinger Bands on the chart timeframe and a second pair from a selectable higher timeframe. It averages the two upper bands and the two lower bands, then shades the space between matching bands. It opens a long when the close falls below t

Strategy v4 Volatility & bandsMean reversion Repaints
Updated 2 months ago · None stated GitHub repository of Multi Bollinger Bands [Alorse]

Wick Hunter VWAP

by avatar-lavventura
2 stars

Calculates a custom Volume Weighted Average Price (VWAP) over a user-defined rolling period using standard HLC3 price data. It plots the central VWAP value alongside upper and lower percentage bands positioned 0.7 percent above and below the main average line.

Indicator v4 Moving averagesVolume
Updated 7 months ago · None stated GitHub repository of Wick Hunter VWAP
1 stars

Plots a dynamic level at the midpoint of the 50-bar high-low range and prints BUY or SELL markers on the price chart. It compares the recent summed distance between price and that level with earlier windows stepped back through history, and counts how often pr

Indicator v5 Mean reversionOscillators & momentum
Updated 7 weeks ago · None stated GitHub repository of Auto Symmetric Reversal and Area
106 stars

Automatic Grid Bot Strategy simulates a grid trading system directly on the main price chart. It sets upper and lower price range boundaries and splits the defined range into grid levels to trade long, short, or both directions simultaneously. Users can config

Strategy v5 Support & resistanceMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of Automatic Grid Bot Strategy

Xiao Martin

by wynnforthework
2 stars

Xiao Martin is a Martingale DCA strategy that buys long positions as price drops. It enters an initial long trade and adds subsequent orders whenever price decreases by a user-defined percentage from the last entry price, subject to a cool-down period and bar

Strategy v5 Mean reversion
Updated 1 year ago · None stated GitHub repository of Xiao Martin

升级版的马丁 -- DCA

by wynnforthework
2 stars

This Dollar-Cost Averaging (DCA) strategy enters trades using signal triggers from MACD, MFI, RSI, or Stochastic RSI. When price moves against the position, it executes Martingale safety orders using customizable volume multipliers and step percentages. Exits

Strategy v5 Oscillators & momentumMean reversion Repaints
Updated 1 year ago · None stated GitHub repository of 升级版的马丁 -- DCA

RSI %B on Chart

by zhuzp98
1 stars

This indicator plots the Relative Strength Index (RSI) and its Bollinger Band percentage bandwidth (%B) deviation directly on the price chart. It calculates RSI from a user-defined source and length, applies an EMA, and derives the %B deviation using a configu

Indicator v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of RSI %B on Chart
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]
106 stars

This strategy calculates smoothed average Stochastic lines using exponential moving averages applied to traditional Stochastic values. It triggers long entries when the averaged %K crosses above averaged %D while below 20, and short entries when %K crosses bel

Strategy v5 Oscillators & momentumMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of AVG Stochastic Strategy
1 stars

This strategy enters long positions every Monday at 00:00 UTC on the 15-minute chart. It computes quantity as 10 percent of current equity divided by the bar close, rounded to three decimal places for stability. Market orders open the position and it flattens

Strategy v6 TrendMean reversion
Updated 6 days ago · Apache-2.0 GitHub repository of Parity probe 05 - small equity fraction

This statistical arbitrage strategy uses matrix algebra to calculate dynamic Ordinary Least Squares regression parameters between the chart symbol and a secondary asset. It constructs a synthetic spread and calculates its Z-score. The strategy enters a long po

Strategy v6 Mean reversionScreeners & dashboards
Updated 2 months ago · None stated GitHub repository of TN Matrix OLS Stat Arb Sovereign v6

RSI with Boll %B

by zhuzp98
1 stars

An oscillator shown in a separate pane. It builds an RSI centred on zero with a short default length, smooths it with an EMA, and measures how far the RSI sits from that average in standard-deviation units, similar to Bollinger %B. Dashed lines mark plus and m

Indicator v5 Oscillators & momentumMean reversion
Updated 1 year ago · None stated GitHub repository of RSI with Boll %B
1 stars

This strategy opens a long position at the start of each Monday at midnight by sizing it to 50% of current equity divided by the close price. It automatically flattens the position on the next bar close. No stop loss or take profit is used. The strategy runs o

Strategy v6 Sessions & timeMean reversion
Updated 6 days ago · Apache-2.0 GitHub repository of Parity probe 06 - 50% equity sizing

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]
114 stars

This indicator implements a dual-direction variation of the Williams Vix Fix oscillator in a separate pane. It normalizes price data using min-max scaling to compute both upward and downward synthetic volatility metrics across two selectable calculation modes

Indicator v4 Volatility & bandsMean reversion
Updated 1 year ago · None stated GitHub repository of Combo Williams Vix Fix (Twin)

This long-only strategy trades intra-range mean reversion using standard or augmented Bollinger Bands overlayed on the main price chart. It triggers long entries when price dips below the lower band, provided the band spread stays within a defined threshold. E

Strategy v5 Volatility & bandsMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of B.Bands | Augmented | Intra-range | Long-Only

Percent Rank Reversion

by pineforge-4pass
1 stars

This strategy measures the percentile rank of bar-to-bar close changes and plots that rank in a separate pane with a five-bar simple moving average and fixed overbought, oversold, and midline levels. It enters long when the rank is below the oversold threshold

Strategy v6 Oscillators & momentumMean reversion
Updated 6 days ago · Apache-2.0 GitHub repository of Percent Rank Reversion
1 stars

Plots the time weighted average price on the price chart: a running average of a chosen source, ohlc4 by default, that restarts whenever the selected anchor period begins, one day by default. Inputs set the anchor timeframe, source and an offset. Unlike VWAP,

Indicator v6 Support & resistanceMean reversion
Updated 1 year ago · None stated GitHub repository of Time Weighted Average Price

Bollinger Bands

by be-thomas
65 stars

This indicator plots standard Bollinger Bands directly on the price chart using hardcoded settings of a 5-period length and a 4 standard deviation multiplier. It displays the middle basis line in blue, the upper and lower outer bands in green, and fills the ch

Indicator v4 Volatility & bandsMean reversion
Updated 5 days ago · GPL-3.0 GitHub repository of Bollinger Bands
330 stars

This strategy trades breakouts beyond custom Bollinger Bands and closes positions upon mean reversion back to the central moving average. It enters long when the close crosses above the upper band and exits when the close crosses below the simple moving averag

Strategy v4 BreakoutVolatility & bands
Updated 2 months ago · None stated GitHub repository of Bollinger Breakout [kodify]

TylerG FVG BB Reversal

by TradersPost
228 stars

This indicator identifies mean-reversion setups by combining Bollinger Bands with Fair Value Gaps (FVGs). It tracks FVGs that print outside the upper or lower Bollinger Bands and counts them toward an alert threshold. Signals trigger upon gap mitigation (by to

Indicator v6 SMC / ICT / price actionVolatility & bands
Updated 3 months ago · None stated GitHub repository of TylerG FVG BB Reversal
1 stars

This indicator tracks Tom DeMark TD Sequential setup counts in a separate pane. It compares the current close to the close four bars earlier, accumulating positive counts during upward momentum and negative counts during downward momentum. The values display a

Indicator v5 TrendMean reversion
Updated 1 year ago · None stated GitHub repository of TD Sequential Number
330 stars

Exceeded Candle [Alorse] is a mean-reversion strategy that identifies candlestick engulfing patterns combined with Bollinger Bands filters. It enters a long position when a green candle surpasses the body of the previous red candle while price is below the mid

Strategy v4 Mean reversionCandlestick patterns
Updated 2 months ago · None stated GitHub repository of Exceeded candle [Alorse]

This indicator tracks completed cycles of a selected bounded oscillator from one extreme zone to the opposite extreme. It stores historical attempts and reports how often the opposite zone was reached, conditioned on progress already made, cycle age, and a tre

Indicator v6 Oscillators & momentumMean reversion
Updated 2 days ago · MIT GitHub repository of Oscillator Cycle Statistics [WavesUnchained]
1 stars

A mean-reversion strategy that buys when price closes below a Bollinger Band while RSI stays above a floor level, and exits on upper-band breaks combined with RSI or MFI conditions. Three selectable versions exist: the first has no stop loss or take profit, wh

Strategy v4 Mean reversionVolatility & bands
Updated 1 year ago · None stated GitHub repository of Flawless Victory Strategy
1 stars

A strategy that buys pullbacks in uptrends and sells rallies in downtrends. Trend comes from fast and slow EMAs with a minimum slope, an optional higher-timeframe EMA check defaulting to daily, and an ADX filter. A setup arms when price stretches an ATR distan

Strategy v6 Mean reversionTrend Repaints
Updated 7 days ago · GPL-3.0 GitHub repository of Trend-Aligned Mean Reversion Strategy

More Pine Script Categories

Browse the whole Pine Library

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.
  7. 7What Pine Script isThe language, what it can and cannot do, and where to start.
  8. 8Write your first indicatorA complete script, line by line, in the Pine Editor.
  9. 9Read a script before you trust itA routine for checking inputs, logic and red flags.
  10. 10Edit a script safelyChange colours and lengths, add a filter or an alert.
  11. 11Pine Script alertsalertcondition(), alert(), placeholders and webhooks.
  12. 12Build a crossover strategyAn EMA cross strategy with an ATR stop, ready to test.

Trade Your Charts With a Regulated Broker

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

Compare brokers