Pine Library · 657 open-source scripts

Free Mean Reversion Pine Scripts (page 13)

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

This strategy calculates the WaveTrend oscillator alongside Stochastic RSI to identify reversal setups at overbought and oversold extremes. It enters long positions when the WaveTrend oscillator crosses upward below configured oversold levels, and enters short

Strategy v6 Oscillators & momentumMean reversion Repaints
Updated 2 days ago · MIT GitHub repository of WaveTrend v4 [WavesUnchained] Strategy
1 stars

This strategy computes a Stochastic Oscillator K and D lines with customizable length, smooth periods, and overbought/oversold thresholds. It generates long signals on K/D crossover below the oversold level in a bullish regime defined by price above a 200 EMA,

Strategy v6 Oscillators & momentumMean reversion
Updated 2 months ago · None stated GitHub repository of Tn Sovereign Stoch v6

Grid Bot Simulator

by regalouisei
2 stars

Calculates evenly spaced grid levels across a user-defined price range bounded by upper and lower limits. It triggers simulated buy signals when price drops across a grid level and sell signals when price crosses upward through a level, evaluated via bar extre

Indicator v5 Support & resistanceMean reversion
Updated 8 months ago · None stated GitHub repository of Grid Bot Simulator
1 stars

This Pine Script strategy enters long positions at specific times of day on the price chart. It places entries at 00:15 and 06:15 each day. It then exits or closes positions at 00:45 and 06:45 using a limit order above the average entry price and a stop order

Strategy v6 Sessions & timeMean reversion
Updated 6 days ago · Apache-2.0 GitHub repository of PF probe 70 - exit close same pass
1 stars

This strategy runs on the price chart and enters long positions at the top of each hour when the position is flat. It then closes those longs at the end of the hour while simultaneously entering a short position with a stop loss just below the low. Later in th

Strategy v6 Sessions & timeMean reversion
Updated 6 days ago · Apache-2.0 GitHub repository of PF probe 72 - opposite entry close

S2

by hasnocool
106 stars

S2 is a cryptocurrency rebalancing strategy originally designed for trading pairs like XTZ-EUR. It enters trades during buy and sell opportunity windows determined by rebalancing logic using external portfolio libraries. The strategy transacts a fixed base cry

Strategy v5 Mean reversionScalping
Updated 2 years ago · GPL-3.0 GitHub repository of S2

(IK) Base Break Buy

by hasnocool
106 stars

This price-chart strategy marks a base when enough recent bar bottoms cluster within a set deviation of the current bottom, then ignores new bases that sit too close to existing ones. A buy is considered when price falls a chosen percentage below a base inside

Strategy v4 Support & resistanceBreakout
Updated 2 years ago · GPL-3.0 GitHub repository of (IK) Base Break Buy

Tn Sovereign VWAP

by raybird
1 stars

A mean reversion strategy built on an anchored VWAP with standard deviation bands, drawn on the price chart. The anchor resets each session, day or week. It buys when price crosses below the lower band with RSI oversold while above a 200 EMA, and sells short o

Strategy v6 Mean reversionVolume
Updated 2 months ago · None stated GitHub repository of Tn Sovereign VWAP

(IK) Grid Script

by hasnocool
106 stars

This strategy overlays an automated grid trading system directly onto the price chart. It defines upper and lower boundaries either manually or dynamically using recent price extremes or a simple moving average with deviation bands. An array of evenly spaced g

Strategy v4 Support & resistanceMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of (IK) Grid Script

10PreBuyer

by hasnocool
106 stars

10PreBuyer is a dip-buying strategy that submits limit orders below recent price action using a discounted Hull Moving Average (HMA). It calculates the highest HMA value of high prices over a selected period, multiplied by a percentage discount factor, and pla

Strategy v4 Moving averagesMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of 10PreBuyer
1 stars

This strategy detects value area rejections on the price chart. It calculates a fair value midpoint using a simple moving average of length 50 and ATR-based bands. Bullish and bearish rejection signals trigger when price crosses the value area boundaries and c

Strategy v6 Mean reversionVolatility & bands
Updated 2 months ago · None stated GitHub repository of Tn Value Area Rejection v6
1 stars

The script calculates the yield spread between long-term and short-term US Treasury yields (T10Y2Y or manual US10Y minus US02Y) and plots the spread line on a separate pane. It signals long entries on steepening beyond a user threshold in reversion mode or SMA

Strategy v6 Mean reversionSupport & resistance
Updated 2 months ago · None stated GitHub repository of TN Yield Spread Sovereign v6

Hurst Exponent (HURST)

by mihakralj
99 stars

Calculates and plots the Hurst Exponent to quantify the persistence, mean-reverting tendencies, or random walk characteristics of a time series. It computes logarithmic returns, segments the lookback window into sub-periods to determine rescaled range statisti

Indicator v6 TrendMean reversion
Updated 4 weeks ago · Apache-2.0 GitHub repository of Hurst Exponent (HURST)

VWAP Trader NXi

by eddiebelaval
7 stars

VWAP Trader NXi calculates a daily session-anchored Volume Weighted Average Price along with two custom standard deviation bands on the main price chart. It plots the core VWAP, Value Area bands, outer extension zones with background shading, and the previous

Indicator v5 VolumeVolatility & bands
Updated 3 months ago · None stated GitHub repository of VWAP Trader NXi
106 stars

This strategy backtests a long Bollinger Band deal on the price chart for 3Commas-style bots. It plots short and long simple moving averages, offset bands, and the average entry price of the open deal. A long starts when price crosses the lower band inside a c

Strategy v4 Volatility & bandsMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of 3Commas Bollinger Strategy

Calculates and plots a multi-band envelope on the price chart based on mean reversion principles and Keltner Channel concepts. Instead of standard moving averages, it uses advanced filters such as Ehlers SuperSmoother, Butterworth, Gaussian, or traditional ave

Indicator v5 Mean reversionVolatility & bands
Updated 5 months ago · None stated GitHub repository of Mean Reversion Channel - MRI Variant

TnS_IctCombo_V6

by raybird
1 stars

This Pine Script strategy identifies high-confluence trading opportunities using ICT and SMC logic. It calculates a confluence score from HTF bias via EMA, FVG detection with lookback, liquidity sweep confirmation, market structure shift breaks, premium discou

Strategy v6 SMC / ICT / price actionTrend Repaints
Updated 2 months ago · None stated GitHub repository of TnS_IctCombo_V6

Trailering Q004

by ruckard
13 stars

Trailering Q004 is an execution strategy that generates automated trading signals integrated with Zignaly webhooks. It uses historical statistical advice and price excursion limits to enter long or short positions based on sub-strategy trigger conditions. The

Strategy v5 TrendMean reversion
Updated 1 year ago · None stated GitHub repository of Trailering Q004

8 Day Run

by hasnocool
106 stars

Inspired by Linda Raschke's strategy for T-note futures, this script identifies extended trends where price remains on one side of a 5-period SMA for more than eight consecutive bars. It enters long on the first pullback below the SMA following an eight-bar bu

Strategy v4 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of 8 Day Run

8 Whittle Down

by hasnocool
106 stars

This strategy executes short positions during the end-of-day session (14:29–15:00) when the price is below the 200-day simple moving average. If price moves higher against the initial short trade, it scales into the position by submitting a second short order

Strategy v4 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of 8 Whittle Down
1 stars

The strategy detects range expansion by comparing the previous bar's range to its ATR multiple. It places pending stop entries above highs of up bars or below lows of down bars. On trigger it enters positions with take profit and stop loss in ticks using OCA g

Strategy v6 Volatility & bandsSupport & resistance
Updated 6 days ago · Apache-2.0 GitHub repository of PF probe 97 - tp/sl gap reversal oca

Traiversal A001

by ruckard
13 stars

Traiversal A001 is a breakout reversal strategy designed primarily for cryptocurrency trading. It identifies reversal entry opportunities three candles following a breakout and closes positions when a breakout in the opposite direction occurs. The script inclu

Strategy v5 BreakoutMean reversion
Updated 1 year ago · None stated GitHub repository of Traiversal A001
1 stars

A reversal strategy that looks for liquidity sweeps: price pokes beyond the prior swing high or low and closes back inside. Entries must agree with a higher-timeframe EMA 50 and 200 trend, pass an ATR volatility corridor and a candle body check, and optionally

Strategy v6 Mean reversionVolatility & bands
Updated 2 months ago · None stated GitHub repository of TnSovereign Reversal Engine

A Strategy for Leledec

by hasnocool
106 stars

This Pine Script strategy identifies major and minor Leledec exhaustion bars by tracking consecutive price bar comparisons against past closes and checking local extremes over set lookback lengths. It overlays visual markers directly on the price chart for det

Strategy v4 Mean reversionCandlestick patterns
Updated 2 years ago · GPL-3.0 GitHub repository of A Strategy for Leledec
1 stars

A momentum reversal strategy that uses the WaveTrend oscillator. A long is considered when the fast line crosses above its signal line from below the oversold level, and a short on a cross down from above the overbought level. A custom free energy and fractal

Strategy v6 Oscillators & momentumMean reversion
Updated 2 months ago · None stated GitHub repository of TnSovereign WaveTrend
106 stars

This overlay strategy plots Bollinger Bands from a simple moving average and standard deviation, plus a separate moving-average line and a background color when that average sits outside the bands. It opens a long when the source crosses above the lower band a

Strategy v4 Volatility & bandsMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of Advanced Bollinger Bands Strategy
1 stars

This strategy plots the Kaufman Adaptive Moving Average on the price chart as an overlay. It generates buy signals on ta.crossover of close above the KAMA and sell signals on ta.crossunder of close below the KAMA. Long entries occur when flat or short, short e

Strategy v6 Moving averagesTrend Repaints
Updated 6 days ago · Apache-2.0 GitHub repository of PF Probe Kanuck-Probe-01-Kama-State

Ruckard Scalping 03

by ruckard
13 stars

This strategy trades both long and short on the price chart. It enters long after a five percent or larger drop over the last thirty minutes and short after a matching rise. Two dollar-cost-averaging adds increase size when price moves against the position. A

Strategy v4 ScalpingMean reversion
Updated 1 year ago · None stated GitHub repository of Ruckard Scalping 03

ADX + RSI Strat

by hasnocool
106 stars

This strategy combines a 7-period RSI with an ADX filter to trade market regimes on the price chart. When the ADX indicates ranging conditions below a set threshold, it triggers entries on RSI overbought or oversold extremes. By default, the entry logic is inv

Strategy v4 Oscillators & momentumTrend
Updated 2 years ago · GPL-3.0 GitHub repository of ADX + RSI Strat
1 stars

This strategy detects liquidity sweep patterns based on pivot high and pivot low levels calculated over configurable left and right bar periods. A bullish sweep occurs when a candle's low pierces below the most recent pivot low while closing back above it, tri

Strategy v6 SMC / ICT / price actionSupport & resistance
Updated 6 days ago · Apache-2.0 GitHub repository of PF Probe Liquidity-Sweep-Probe-02-Sweep-Bar

This strategy tracks liquidity sweeps across pivot highs and lows to trigger delayed reversal entries. It identifies pivots based on configurable left and right bar lengths and records sweeps when the price breaches a pivot but closes back inside it. Upon dete

Strategy v6 SMC / ICT / price actionSupport & resistance
Updated 6 days ago · Apache-2.0 GitHub repository of PF probe liquidity-sweep-probe-03-reentry-on-sweep
1 stars

This indicator calculates dynamic symmetry lines by reflecting lagged price points across upper and lower boundary bands. Users can choose between Bollinger Bands or Donchian Channels to define the baseline boundaries. The script generates alternating BUY and

Indicator v5 Volatility & bandsSupport & resistance
Updated 7 weeks ago · None stated GitHub repository of Spiral Symmetric Signals
1 stars

This strategy calculates dynamic upper and lower boundaries over a specified lookback period alongside expanding mathematical spiral levels. It monitors price rejections where candles penetrate the upper or lower spiral bounds but close back within them. When

Strategy v5 Support & resistanceMean reversion
Updated 7 weeks ago · None stated GitHub repository of Spiral Symmetric Strategy

All-time-high

by hasnocool
106 stars

This strategy tracks the highest price on the chart and plots that all-time high plus bands at 90, 80, and 70 percent of it. It enters a long when the close falls below a user-set fraction of the high, defaulting to 80 percent, using full equity. It closes the

Strategy v4 Support & resistanceMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of All-time-high
1 stars

This strategy composes confirmed pivot breaks, a rolling price extreme, and a state-edge detector into overlay entries on the price chart. Market state turns bullish when close breaks the latest confirmed pivot high and bearish on a break of the latest pivot l

Strategy v6 Support & resistanceBreakout
Updated 6 days ago · Apache-2.0 GitHub repository of PF probe market-shift-probe-integration
1 stars

TnSovereignVwapRegimeV6 is a mean-reversion strategy designed to trade price exhaustion away from the volume-weighted average price (VWAP). It calculates standard deviation bands around a session VWAP and tracks price deviation in normalized standard deviation

Strategy v6 Mean reversionVolatility & bands
Updated 2 months ago · None stated GitHub repository of TnSovereignVwapRegimeV6
1 stars

Calculates the classic WaveTrend oscillator using exponential moving averages and absolute deviations of typical price. Entries trigger on momentum reversals across timeframe-specific overbought and oversold thresholds, filtered through configurable quality ga

Strategy v6 Oscillators & momentumMean reversion
Updated 2 months ago · None stated GitHub repository of TnSovereignWaveTrendV4
99 stars

The Mean Squared Error indicator calculates the mean of squared differences between a source series and its EMA, averaged via a rolling buffer acting as SMA. This error metric plots as a filled red area on a separate pane, while the EMA overlays as a yellow li

Indicator v6 Volatility & bandsMean reversion
Updated 4 weeks ago · Apache-2.0 GitHub repository of Mean Squared Error (MSE)
1 stars

This indicator plots the original simple moving average, a symmetric moving average calculated from the highest and lowest moving averages over the window length, and a dynamic midline. It generates buy signals when the deviation from the symmetric moving aver

Indicator v5 Moving averagesTrend
Updated 7 weeks ago · None stated GitHub repository of Symmetric MA Reversal Signals
106 stars

This strategy simulates a 3Commas dollar-cost averaging (DCA) bot directly on the price chart. It opens long or short deals based on configurable conditions such as immediate execution, RSI-7 thresholds, or TradingView technical presets. As price moves against

Strategy v4 Oscillators & momentumMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of Backtesting 3commas DCA Bot v2
1 stars

This strategy calculates a 14-period RSI of close and places mean-reversion entries at fixed outer bands. It enters long when RSI crosses up through 30 and enters short when RSI crosses down through 70. Position size is a fixed quantity of one, with commission

Strategy v6 Oscillators & momentumMean reversion
Updated 6 days ago · Apache-2.0 GitHub repository of PF TA isolate 02 - RSI(14) bands 30/70

BB + ADX Strategy

by hasnocool
106 stars

The BB + ADX Strategy triggers entries when price crosses Bollinger Bands during low-trend market conditions as filtered by the Average Directional Index (ADX). It enters long when price crosses above the lower band and short when price crosses below the upper

Strategy v4 Volatility & bandsOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of BB + ADX Strategy
99 stars

Normal Distribution CDF (NORMDIST) calculates the cumulative distribution function for a normalized price series in a separate indicator pane. It standardizes price values using a rolling mean and standard deviation over a customizable lookback window, then sc

Indicator v6 Mean reversion
Updated 4 weeks ago · Apache-2.0 GitHub repository of Normal Distribution CDF (NORMDIST)

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