Pine Library · 657 open-source scripts

Free Mean Reversion Pine Scripts (page 12)

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

MACD + BB + RSI

by zhuzp98
1 stars

A Pine version 4 strategy on the price chart that buys when the MACD line crosses above its signal line while RSI is below 50 and price is under the Bollinger basis. It exits when RSI exceeds 70 and price is above the upper band. MACD moving average types, ban

Strategy v4 Oscillators & momentumMean reversion
Updated 1 year ago · None stated GitHub repository of MACD + BB + RSI

Stocks Buy The Dip

by tseitz
1 stars

An indicator on the price chart that highlights a possible dip entry by shading the background green. The condition is a MACD line crossing above its signal line while MACD is at or below zero and the 14 period RSI sits under a buy threshold, 52 by default. Th

Indicator v4 Oscillators & momentumMean reversion
Updated 4 years ago · None stated GitHub repository of Stocks Buy The Dip

Funded Range Gann Sniper

by vedkanani123
1 stars

A price-chart indicator that looks for fade setups after price raids the edge of a completed session or prior-day range and closes back inside. It requires the Gann half-range level to sit at least a set number of R away, sizes the stop beyond the raid using A

Indicator v6 SMC / ICT / price actionSupport & resistance Repaints
Updated 2 months ago · None stated GitHub repository of Funded Range Gann Sniper
13 stars

This strategy enters long when WaveTrend reads the market as oversold and short when it reads the market as overbought. It draws on the price chart and uses a reverse strategy type with optional start and stop dates. Stop loss is enabled by default and can fol

Strategy v5 Oscillators & momentumMean reversion
Updated 1 year ago · None stated GitHub repository of Ruckard LazyBear WaveTrend A002

This indicator classifies market behavior into momentum, mean-reversion, noise, or mixed regimes. It fuses four statistical predictability sensors—Variance Ratio across multiple horizons, return autocorrelation, Hurst exponent approximation, and fractal effici

Indicator v6 TrendMean reversion
Updated 2 days ago · MIT GitHub repository of Predictability Regime Index [WavesUnchained]

BB Strategy tooba

by hasnocool
106 stars

This strategy executes trades based on Bollinger Band crossovers on the price chart. It calculates a simple moving average basis along with standard deviation bands. When the closing price crosses above the lower band, it places a long stop order, and when pri

Strategy v5 Volatility & bandsMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of BB Strategy tooba

BB%B Strat

by hasnocool
106 stars

This strategy trades mean-reversion setups using the Bollinger Bands Percent Bandwidth (%B) oscillator plotted in a separate pane. It calculates upper and lower bands using a simple moving average and standard deviation multiplier. Long positions are entered w

Strategy v5 Volatility & bandsMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of BB%B Strat

VWAP Delta

by ivansoft
1 stars

An indicator in a separate pane that plots how far price is from an anchored volume weighted average price, as a percentage of the VWAP. The VWAP itself is drawn on the price chart. Percentile lines over a chosen number of bars mark the two upper and lower ext

Indicator v6 Volatility & bandsMean reversion
Updated 1 year ago · None stated GitHub repository of VWAP Delta

BBPullback

by hasnocool
106 stars

This strategy executes pullback trades based on internally computed Bollinger Bands and candle price action directly on the main price chart. It tracks breakout and pullback states to trigger long and short entries. Users can select among three distinct take p

Strategy v5 Volatility & bandsMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of BBPullback
106 stars

BEAM DCA Strategy Monthly calculates long-term risk bands around a moving average baseline to implement a monthly dollar-cost averaging strategy. It normalizes asset risk between 0 and 1, placing buy orders when risk falls below 0.5 on a specific day of the mo

Strategy v5 Moving averagesSupport & resistance
Updated 2 years ago · GPL-3.0 GitHub repository of BEAM DCA Strategy Monthly

The strategy uses RSI(14) on closing prices to detect upward crossovers above 50 for long entries and downward crossovers below 50 for exits. A protective stop loss is placed at the midpoint between open and high on the entry bar to handle mid-bar fills via ma

Strategy v6 Oscillators & momentumMean reversion
Updated 6 days ago · Apache-2.0 GitHub repository of PF Magnifier Dist Probe 08a - Endpoints RSI Cross

This strategy combines Larry Williams' Vix Fix synthetic volatility indicator with Bollinger Bands. It calculates standard and inverted Williams Vix Fix metrics, displaying them as histogram columns with standard deviation bands in a separate pane. Long entrie

Strategy v4 Volatility & bandsOscillators & momentum
Updated 2 months ago · None stated GitHub repository of Williams Vix Fix Strategy [Alorse]
2 stars

This strategy enters long positions when the Relative Strength Index drops into oversold territory on a confirmed bar. It exits when RSI rises back to a target sell level, provided an optional minimum profit percentage threshold is satisfied. At trade entry, a

Strategy v4 Oscillators & momentumMean reversion
Updated 2 years ago · None stated GitHub repository of RSI Mean Reversion Strategy 2021

Pretty Good Oscillator

by mihakralj
47 stars

The Pretty Good Oscillator calculates the distance between the selected price source and its simple moving average, normalized by the Average True Range over a specified period. It renders as an oscillator line in a separate pane alongside a zero line and thre

Indicator v6 Oscillators & momentumMean reversion
Updated 8 months ago · MIT GitHub repository of Pretty Good Oscillator
1 stars

A strategy that changes its entry type with volatility and uses a 200 EMA as a direction gate, long above and short below. When ATR is below its average it fades moves beyond the prior range. When ATR is expanding it takes range breakouts that close with a str

Strategy v6 Volatility & bandsBreakout
Updated 2 months ago · None stated GitHub repository of TN Sovereign Adaptive Regime
261 stars

This indicator calculates standardized z-scores of price data across four different lookback periods (6, 14, 26, and 100). Standardizing data subtracts the moving average from the price and divides by the standard deviation. It applies a Double Exponential Mov

Indicator v5 Mean reversionVolatility & bands
13 stars

This strategy evaluates market trend direction using a Noro TrendRibbon and creates a price corridor based on recent moving-average extremes, plotting directly on the price chart. It executes long entries when price dips below the corridor during an upward tre

Strategy v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ruckard Noro TrendRibbon G004
2 stars

Rolling Z-Score Trend [QuantAlgo] calculates a rolling Z-score using mean and standard deviation over a user-defined lookback window to evaluate statistical price deviations and momentum. Plotted in a separate indicator pane, it displays the rolling Z-score li

Indicator v6 TrendOscillators & momentum
Updated 8 months ago · None stated GitHub repository of Rolling Z-Score Trend [QuantAlgo]

A strategy based on Bollinger Bands that enters long positions when price crosses above the lower band and short positions when price crosses below the upper band. Take-profit, stop-loss, and scale-in price levels are dynamically calculated from the position a

Strategy v5 Volatility & bandsMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of Bollinger Band Strategy with Split, Limit, Stop
13 stars

A trend-following strategy that combines the Noro TrendRibbon direction filter with high and low moving average corridors. It determines the dominant market direction from the trend ribbon and opens positions when price moves outside the corridor, taking long

Strategy v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ruckard Noro TrendRibbon I002

Signal Quality Engine [WavesUnchained] is a range-fade indicator that identifies exhaustion at range extremes and signals potential reversals. It applies an ADX and EMA slope regime gate to stand down during strong trends. Using distance, structure, and moment

Indicator v6 Mean reversionSupport & resistance
Updated 2 days ago · MIT GitHub repository of Signal Quality Engine [WavesUnchained]

S Trailing

by GammaExpansion
1 stars

S Trailing is a Pine Script v6 strategy that applies trailing stops to periodic cycle-based entries. It divides the bar index into cycles of 40 bars and activates at specific phases: long entry with trailing price stop at phase 0, short entry at phase 14, plus

Strategy v6 Mean reversionScalping
Updated 6 days ago · MIT GitHub repository of S Trailing
1 stars

The strategy monitors the lower timeframe close crossing above the previous daily high obtained via request.security on the daily chart. It enters a long position of one unit upon detection of this cross-up condition and closes the position when the close fall

Strategy v6 BreakoutMean reversion
Updated 6 days ago · Apache-2.0 GitHub repository of PF MTF probe 04 — D high[1] break
106 stars

This strategy plots a 20-period Bollinger Band and a 9-period EMA on the price chart. It opens a long when the prior close is below the lower band and the current candle is bullish, and a short when the prior close is above the upper band and the current candl

Strategy v5 Volatility & bandsMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of Bollinger Bands + EMA 9
13 stars

This strategy uses Noro TrendRibbon direction to set a long or short bias, then opens a trade when price leaves a high-low corridor built from recent candles. A long opens below the corridor in a long bias, and a short opens above it in a short bias, sized fro

Strategy v5 TrendMoving averages
Updated 1 year ago · None stated GitHub repository of Ruckard Noro TrendRibbon Ladder
114 stars

This indicator calculates normalized percentage bounds around price highs and lows to anticipate local trend reversals. It oscillates within a fixed -1 to 1 channel and plots two boundary tracking curves alongside a background Karobein oscillator histogram for

Indicator v4 Mean reversionOscillators & momentum Repaints
Updated 1 year ago · None stated GitHub repository of Mean Reversion Indicator
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
106 stars

This strategy executes short trades based on Bollinger Bands and the Relative Strength Index (RSI). It plots the Bollinger Bands on the price chart and enters a short position when the closing price crosses above the upper band while RSI remains below 70. An e

Strategy v5 Volatility & bandsOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of Bollinger Bands and RSI Short Selling
1 stars

This strategy identifies pivot-based Darvas Box levels on the price chart and trades re-entries following box sweeps. A long position arms when the price dips below the lower boundary and triggers when it closes back inside, provided the price is above a highe

Strategy v6 Support & resistanceBreakout
Updated 2 months ago · None stated GitHub repository of TN Sovereign Darvas Box v6

This strategy calculates standard Bollinger Bands using a Simple Moving Average and standard deviation multiplier. It enters alternating long positions when price crosses above the lower band and short positions when price crosses below the upper band. Open tr

Strategy v5 Volatility & bandsMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of Bollinger Bands Strategy With StopLoss

This strategy calculates standard Bollinger Bands using a Simple Moving Average and standard deviation multiplier to identify entry conditions. It triggers pending stop orders and outputs formatted alert messages compatible with TradingConnector for automated

Strategy v5 Volatility & bandsMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of Bollinger Bands Strategy with TradingConnector Alerts
47 stars

Calculates the rolling Z-score of an input price series over a specified lookback window. It uses a sliding window array to maintain rolling sums and calculate the sample mean and sample standard deviation incrementally, accounting for missing values. The resu

Indicator v6 Mean reversionOscillators & momentum
Updated 8 months ago · MIT GitHub repository of Standardization (Z-score)

Breakeven Line Demo

by hasnocool
106 stars

The Breakeven Line Demo strategy is a Pine Script demonstration tool designed to visualize the average position price of stacked trades. It enters long positions after seven consecutive bearish candles and short positions after seven consecutive bullish candle

Strategy v5 Mean reversionSupport & resistance
Updated 2 years ago · GPL-3.0 GitHub repository of Breakeven Line Demo
99 stars

Calculates John Ehlers' Reflex indicator to measure price cycle reversal tendencies and trend direction with low lag. The script pre-filters price data using a two-pole Super Smoother Filter, measures linear extrapolation slope deviations over a lookback windo

Indicator v6 Oscillators & momentumTrend
Updated 4 weeks ago · Apache-2.0 GitHub repository of Ehlers Reflex Indicator
1 stars

PF Probe 4EMA-RSI Probe 02 RSI Pullback is a stateful momentum strategy that triggers trades based on Relative Strength Index dip-and-recovery patterns. It arms a persistent long variable when RSI drops below a pullback threshold and opens a long trade when RS

Strategy v6 Oscillators & momentumMean reversion
Updated 6 days ago · Apache-2.0 GitHub repository of PF Probe 4EMA-RSI-Probe-02-RSI-Pullback
114 stars

This indicator implements a distance-based pair trading strategy applied across two timeframes of the same instrument. It calculates the spread or statistical distance between price data on the active chart and a secondary timeframe using selected metrics like

Indicator v4 Mean reversion
Updated 1 year ago · None stated GitHub repository of SpreadTrade: Distance (v.2)
7 stars

This strategy plots RSI on the price chart and enters a long when RSI falls below the oversold level or a short when it rises above the overbought level, only while flat. It exits with a take profit and stop loss measured in pips from the current close. Inputs

Strategy v6 Oscillators & momentumScalping
Updated 3 months ago · None stated GitHub repository of XAUUSD 1-Minute Scalping Strategy

BTC/USD - RSI

by hasnocool
106 stars

This strategy calculates the Relative Strength Index (RSI) to generate mean-reversion signals based on multi-tier overbought and oversold thresholds. When the RSI falls below the oversold levels without an active trade, it enters a long position; conversely, w

Strategy v5 Oscillators & momentumMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of BTC/USD - RSI
13 stars

This strategy runs on the price chart to identify trade entries using volume sequences, specifically tracking consecutive declining volume candles followed by a volume surge at lower price levels. It provides webhook execution support for Zignaly copy trading

Strategy v5 VolumeVolatility & bands
Updated 1 year ago · None stated GitHub repository of Ruckard Voladder A002

NO.1 V3 Dual-Regime Router

by vedkanani123
1 stars

A price-chart indicator that classifies the market into trend, range, transition or shock regimes using an adaptive core, ATR, ADX, choppiness and efficiency measures. Each regime has its own sleeve: trend-following on structure and momentum, range-edge revers

Indicator v6 TrendBreakout
Updated 2 months ago · None stated GitHub repository of NO.1 V3 Dual-Regime Router

My Script

by ricardosantos79
261 stars

This indicator uses array operations to track recent high and low values. It defines helper functions to insert values into a fixed-size array. On each bar it calculates the 10-bar highest high and lowest low, then checks for the formation of a new high or low

Indicator v4 Support & resistanceMean reversion
Updated 4 years ago · None stated GitHub repository of My Script
13 stars

This strategy identifies volume-based rebound signals on the price chart. It detects three or more consecutive lower volume candles followed by a higher volume candle, with price remaining lower from the start of the volume sequence, signaling potential long e

Strategy v5 VolumeBreakout
Updated 1 year ago · None stated GitHub repository of Ruckard Voladder D002
1 stars

A price-chart indicator that combines trend, range edge reversal and transition breakout sleeves, with shock conditions blocking new signals. It uses an adaptive core, causal trail, completed ranges and a previous completed higher-timeframe filter. Presets suc

Indicator v6 TrendBreakout Repaints
Updated 2 months ago · None stated GitHub repository of NO.1 V5 Ultimate Adaptive Engine

This overlay indicator plots a session VWAP that resets daily plus pivot-anchored VWAP highs and lows. It marks price crosses of those VWAPs, crosses between session and anchored VWAPs, and clusters where several VWAP lines sit close together. Display mode, cl

Indicator v6 VolumeSessions & time
Updated 2 days ago · MIT GitHub repository of VWAP Cross Visuals [WavesUnchained]

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