Pine Library · 657 open-source scripts

Free Mean Reversion Pine Scripts (page 7)

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

XAUUSD-Asia Reversion

by riegodavid-git
1 stars

An overlay indicator written for gold during a morning window in Philippine time. It combines a short-period RSI with fractal sweep detection, where price takes out recent fractal highs or lows, and fair value gap boxes with optional volume, ATR and trend filt

Indicator v6 SMC / ICT / price actionMean reversion
Updated 4 months ago · None stated GitHub repository of XAUUSD-Asia Reversion

Jasper Working OB Strategy

by Alberto082544
1 stars

Jasper Working OB Strategy is an indicator that detects bullish and bearish order blocks (OB) from fair value gaps and displacement conditions. It stores the OB zones on the chart and maintains persistent memory of touches to these zones. Reversal signals trig

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 5 months ago · None stated GitHub repository of Jasper Working OB Strategy
1 stars

This strategy looks for VWAP bounce and rejection trades on the price chart during the regular trading session. It marks a percentage band around session VWAP and enters when a rejection candle meets a minimum wick-to-body ratio and volume exceeds a multiple o

Strategy v6 Mean reversionVolume
Updated 7 months ago · MIT GitHub repository of VWAP Bounce/Rejection
1 stars

Relative Volatility Index is a Pine v5 strategy that calculates a relative volatility index and draws Bollinger Bands, with a basis line and fill, in a separate pane with reference lines at 20 and 80. The index line itself is commented out of the plots. It goe

Strategy v5 Volatility & bandsMean reversion Archived
Updated 4 years ago · None stated GitHub repository of Relative Volatility Index

MTF RSI

by Alorse
330 stars

This strategy enters long when price is above a long moving average and the RSI falls below an oversold level. It closes the long position when the RSI rises above an overbought level or price drops below the moving average. The RSI length, oversold and overbo

Strategy v5 Oscillators & momentumMoving averages
Updated 2 months ago · None stated GitHub repository of MTF RSI

[TradersPost] Sick Sigma

by TradersPost
228 stars

Sick Sigma detects extreme statistical standard deviation moves (sigma events) to execute trades directly on the main price chart. The strategy supports both momentum and mean-reversion trading styles. Traders can configure calculation lookback periods, sigma

Strategy v6 Volatility & bandsMean reversion Repaints
Updated 3 months ago · None stated GitHub repository of [TradersPost] Sick Sigma

This overlay strategy backtests a dollar-cost-averaging bot on the price chart. It opens a long base order when the selected oscillator signals: MACD line cross, MFI or RSI below a threshold, or Stochastic RSI K crossing above D. Further orders average down by

Strategy v5 Oscillators & momentumMean reversion Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of 3Commas Bot DCA Backtester & Signals FREE
99 stars

The Augmented Dickey-Fuller indicator calculates statistical stationarity and tests for unit roots in price series over a rolling window. It performs ordinary least squares regression on differenced historical price data to compute a t-statistic and an estimat

Indicator v6 Mean reversionTrend
Updated 4 weeks ago · Apache-2.0 GitHub repository of ADF - Augmented Dickey-Fuller Test

RSI Threshold

by latentwill
4 stars

This strategy calculates the Relative Strength Index of the close and is configured for a separate pane. It opens a long position when RSI is below the oversold level and a short position when RSI is above the overbought level. Position size defaults to ten pe

Strategy v5 Oscillators & momentumMean reversion
Updated 7 days ago · None stated GitHub repository of RSI Threshold
4 stars

This strategy overlays directly on the price chart to identify pullback buying opportunities during established bullish moves. It checks whether price gained by a specified percentage over an earlier window and subsequently pulled back by a minimum threshold o

Strategy v5 TrendMean reversion
Updated 5 months ago · None stated GitHub repository of Buy the Dip in an Uptrend
4 stars

Calculates Bollinger Bands, RSI, and Stochastic to identify potential reversal opportunities directly on the price chart. It plots buy signals when the bar low is within a set distance of the lower Bollinger Band while both RSI and Stochastic register oversold

Indicator v4 Oscillators & momentumVolatility & bands
Updated 4 years ago · None stated GitHub repository of RSI and Stoch (Brahim)

Ver16-19 RCI Panel

by Pesci1134
2 stars

This indicator calculates the Rank Correlation Index over a customizable period and plots the oscillator in a separate pane. It identifies overbought and oversold market conditions relative to user-defined thresholds. Bullish signals occur when the oscillator

Indicator v5 Oscillators & momentumMean reversion
Updated 2 weeks ago · None stated GitHub repository of Ver16-19 RCI Panel
1 stars

An overlay that draws a session-anchored VWAP with optional standard-deviation bands and reads price above or below it as a bullish or bearish bias. When VWAP is sloping and a candle pulls back near it and closes in the trend direction on a confirmed bar, it m

Indicator v5 VolumeMean reversion
Updated 4 months ago · None stated GitHub repository of VWAP + Volume Levels

XAUUSD-Asia Reversion Strategy

by riegodavid-git
1 stars

A gold strategy built on fractal sweeps, fair value gaps and a short-period RSI. It fades extended moves, using RSI overbought and oversold gates and an overextension timer, and places limit orders that cancel after a set number of bars. The stop is ATR-based

Strategy v6 Mean reversionSMC / ICT / price action
Updated 4 months ago · None stated GitHub repository of XAUUSD-Asia Reversion Strategy

RSI Strategy

by Studentcodee
1 stars

A Pine v6 strategy that trades RSI threshold crosses and draws on the price chart. It computes RSI on the close over a length setting. A long entry fires when RSI crosses up through the oversold level, and a short entry fires when RSI crosses down through the

Strategy v6 Oscillators & momentumMean reversion
Updated 1 year ago · None stated GitHub repository of RSI Strategy
1 stars

This strategy enters long and short trades when MACD histogram state agrees with KDJ filters. Longs need a positive histogram, MACD below zero, and K, D, and J below 30. Shorts need a negative histogram, MACD above zero, and those values above 70. It closes lo

Strategy v5 Oscillators & momentumMean reversion
Updated 1 year ago · None stated GitHub repository of MACD-KDJ Double Cross Strategy
1 stars

A course example strategy with a setting that selects one of three entry rules. The RSI option buys when RSI crosses up through 30 and sells when it crosses down through 70. The MACD option needs a histogram sign and a line cross. The Bollinger option buys bel

Strategy v4 Oscillators & momentumMean reversion
Updated 2 years ago · None stated GitHub repository of My Script Strategy Selector

SPX Sentiment

by nvFede
1 stars

A Pine v4 indicator in a separate pane that divides the S&P 500 index by the VIX volatility index to form a ratio, then compares it with its own average and a z-score style measure over a chosen length. It colours the background by whether the ratio is above o

Indicator v4 Volatility & bandsMean reversion
Updated 3 years ago · None stated GitHub repository of SPX Sentiment

STRG One Bar Pursuit

by harryguiacorn
220 stars

The STRG One Bar Pursuit strategy identifies single-bar momentum reversals by monitoring shifts between bullish and bearish candlesticks starting from the year 2024. It enters a long position when a bullish candle follows a bearish candle and enters a short po

Strategy v5 Candlestick patternsMean reversion
Updated 1 year ago · None stated GitHub repository of STRG One Bar Pursuit
106 stars

This strategy simulates a dollar-cost averaging (DCA) trading bot that enters positions when a short moving average crosses over or under a long moving average. It manages trades by placing scaled safety orders as price drops, lowering the average position ent

Strategy v5 Moving averagesMean reversion
Updated 2 years ago · GPL-3.0 GitHub repository of 3Commas Visible DCA Strategy

Burgle Bounce

by benso87
24 stars

Burgle Bounce is a price-chart strategy that treats a move toward one of up to four simple or exponential moving averages as a test when price comes within a user-set percentage of ATR, then exits toward a target average under a separate error margin. Longs an

Strategy v5 Moving averagesOscillators & momentum Repaints
Updated 4 years ago · MPL-2.0 GitHub repository of Burgle Bounce

Greeffer RSI Strategy

by SammyEnigma
18 stars

Greeffer RSI Strategy is a trading strategy that generates buy and sell entries based on Bollinger Bands and RSI levels. It places stop orders at upper and lower Bollinger Bands on band crossovers, and adds positions when RSI reaches extreme levels. Users can

Strategy v4 Oscillators & momentumVolatility & bands
Updated 6 years ago · None stated GitHub repository of Greeffer RSI Strategy
12 stars

This is a Pine Script strategy that executes a fixed historical backtest on BTC-USD. It places multiple manual trades using strategy.order at specific timestamps and prices, with corresponding close conditions based on time. Some trades are long and some are s

Strategy v4 Mean reversionScalping
Updated 5 years ago · None stated GitHub repository of Lazarus3 BTC Backtest

Keltner Channel Trend - Eterna

by EternaHybridExchange
9 stars

This strategy plots a Keltner channel from an EMA basis and ATR bands on the price chart. It enters long when price crosses back above the lower band while trading above a slower trend EMA, and short when price crosses back below the upper band while below tha

Strategy v5 TrendVolatility & bands
Updated 7 months ago · MIT GitHub repository of Keltner Channel Trend - Eterna

Stochastic Cross

by latentwill
4 stars

This strategy evaluates momentum conditions in a separate pane to trigger long and short positions. Although titled after stochastic crossovers, the code calculates two Relative Strength Index series for trade signals. It enters long when the primary oscillato

Strategy v5 Oscillators & momentumMean reversion
Updated 7 days ago · None stated GitHub repository of Stochastic Cross
2 stars

This strategy identifies price consolidation ranges during Asia session hours and trades mean-reversion reclaims following liquidity sweeps. It marks an initial range box, measures sweep depths past box boundaries using ATR multiples, and enters trades when pr

Strategy v6 Sessions & timeDivergence
Updated 4 weeks ago · Custom licence GitHub repository of MP Asia Range Sweep & Reclaim
1 stars

This strategy executes mean-reversion trades using the Relative Strength Index combined with Bollinger Band boundary audits. It enters long when the RSI crosses above the oversold threshold while the bar low touches or breaches the lower Bollinger Band. Conver

Strategy v6 Mean reversionOscillators & momentum
Updated 2 months ago · None stated GitHub repository of RSI Mean Reversion Sovereign v6

Pivot Points - S/R Trading

by Basant1Saini
1 stars

Calculates classic support and resistance pivot levels using Traditional, Fibonacci, or Camarilla formulas from a higher timeframe. The strategy offers two execution modes: Bounce mode trades reversals within a customizable percentage buffer of support and res

Strategy v5 Support & resistanceBreakout
Updated 7 months ago · None stated GitHub repository of Pivot Points - S/R Trading
1 stars

This strategy plots the Relative Strength Index in a separate pane and fades extremes. It opens a long when RSI crosses back above the oversold level and a short when RSI crosses back below the overbought level. Open trades exit at a percentage stop loss or ta

Strategy v5 Oscillators & momentumMean reversion
Updated 11 months ago · None stated GitHub repository of RSI Mean Reversion Strategy

PAXG Best Position

by theteelek
1 stars

A long-only strategy for the gold-backed PAXG token that buys near the lower edge of a smoothed channel. The channel is an EMA of the highest high and lowest low over an adjustable range, and a buy needs price at the lower line with RSI turning up from oversol

Strategy v6 Mean reversion
Updated 1 year ago · None stated GitHub repository of PAXG Best Position

Slow Stochastic Strategy

by Studentcodee
1 stars

A Pine v6 strategy built on a slow stochastic oscillator and drawn on the price chart. The %K line is the stochastic smoothed by a three-bar average, and %D is a further three-bar average. It enters long when %K crosses above %D while %K is below the oversold

Strategy v6 Oscillators & momentumMean reversion
Updated 1 year ago · None stated GitHub repository of Slow Stochastic Strategy
1 stars

This strategy trades stochastic crossovers in extreme zones. It enters long when %K crosses above %D with both below the oversold level, and short when %K crosses below %D with both above the overbought level. Each entry carries an ATR-based stop loss and take

Strategy v5 Oscillators & momentumMean reversion
Updated 1 year ago · None stated GitHub repository of Stochastic Oscillator Strategy

Bias

by JohnsonHsiao
1 stars

The indicator computes bias and mbias curves from typical price relative to highest and lowest closes across periods 3, 6, 9, 12, and 20. It sums the positive and negative biases then negates and plots them as b (red) and s (green) lines in a separate pane to

Indicator v5 Support & resistanceMean reversion
Updated 3 years ago · None stated GitHub repository of Bias
114 stars

This indicator compares two user-selected symbols by plotting the z-score of their log-price ratio in a separate pane. It averages the ratio with a chosen moving average, measures standard deviation over the same period, and marks a buy when the ratio falls be

Indicator v5 Mean reversion
Updated 1 year ago · None stated GitHub repository of Pair Trading - Cointegration

Linear Regression Channel - Eterna

by EternaHybridExchange
9 stars

This strategy plots a linear regression of close and deviation bands on the price chart. It enters long when price crosses up from the lower band in an uptrend defined by an EMA and a rising regression line, and enters short on a rejection from the upper band

Strategy v5 TrendMean reversion Repaints
Updated 7 months ago · MIT GitHub repository of Linear Regression Channel - Eterna

Simple Hurst Exponent

by Anderson-ALGO
9 stars

This indicator estimates a simple Hurst exponent from the length of the scaled price path over a user-set lookback and plots it in a separate pane. A value above 0.5 is colored differently from a value below 0.5, with a dotted horizontal line at 0.5. An option

Indicator v4 TrendMean reversion
Updated 5 years ago · None stated GitHub repository of Simple Hurst Exponent

RSI

by trsdn
6 stars

This indicator calculates the Relative Strength Index along with a 200-period simple moving average. It plots the RSI oscillator line alongside horizontal reference levels for overbought and oversold thresholds in a separate pane below the main price chart. Co

Indicator v5 Oscillators & momentumMoving averages
Updated 6 days ago · MIT GitHub repository of RSI
4 stars

This strategy trades pullbacks in the direction of a moving-average trend and draws on the price chart. An uptrend requires the 50-period EMA above the 200-period EMA with price above the slower average, and a downtrend is the reverse. It enters long or short

Strategy v6 TrendOscillators & momentum
Updated yesterday · None stated GitHub repository of AG Trend-Pullback Optimized

MP Camarilla Range Bounce

by midngtpickle
2 stars

This strategy fades touches of daily Camarilla pivot boundaries (S3 for longs, R3 for shorts) during sideways market conditions. It plots pivot levels directly on the price chart and validates entries using regime filters, including maximum ADX thresholds, pri

Strategy v6 Support & resistanceMean reversion
Updated 4 weeks ago · Custom licence GitHub repository of MP Camarilla Range Bounce
2 stars

Hulk Grid Algorithm V2 is a grid trading strategy designed for price charts. It establishes ten distinct grid levels around a user-defined mid price, spaced apart by a fixed dollar grid step. The strategy places long limit orders across these levels with scale

Strategy v5 Support & resistanceMean reversion Repaints
Updated 1 year ago · None stated GitHub repository of Hulk Grid Algorithm V2 - The Quant Science

Linear Regression Volume

by vedkanani123
1 stars

An overlay indicator that computes a volume-weighted price average using SMA, RMA, HMA or ALMA, fits a linear regression to it as a fair value baseline, and draws bands at one, two and three standard deviations of price around it. The baseline and band fills t

Indicator v6 TrendVolume
Updated 2 months ago · None stated GitHub repository of Linear Regression Volume
1 stars

Computes a z-score of price against a selectable moving average (SMA, EMA, WMA or VWMA) and compares it with thresholds that can adapt to the volatility regime. Inputs set the lookback, volatility lookback, base, minimum and maximum thresholds, and a signal mo

Indicator v5 Mean reversionVolatility & bands
Updated 6 months ago · None stated GitHub repository of Z-Score Dynamic Bands
1 stars

This strategy looks for mean-reversion entries when RSI crosses back through the oversold or overbought levels, or recovers from more extreme RSI readings. Optional divergence confirmation can require a price and RSI mismatch before entry. It opens one long or

Strategy v5 Mean reversionOscillators & momentum
Updated 7 months ago · None stated GitHub repository of RSI Extremes - Mean Reversion

TeeLek Best Position

by theteelek
1 stars

A long-only accumulation strategy that buys near the lower edge of a smoothed channel, built from an EMA of the highest high and lowest low over an adjustable range. A buy needs price at the lower line while RSI turns up from an oversold reading, with at most

Strategy v6 Mean reversion
Updated 1 year ago · None stated GitHub repository of TeeLek Best Position
1 stars

This strategy fades false breakouts of a rolling high and low. It goes long when the bar's low pokes below the prior lowest low of the lookback window but the close finishes back above it, and short in the mirror case at the highest high. Each trade has an ATR

Strategy v5 Mean reversionBreakout
Updated 1 year ago · None stated GitHub repository of Turtle Soup 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