Indicator · Pine Script v5 · On the chart

Deviation Based Reversion with Stats

by TamaraKGreen

Calculates mean reversion signals using statistical deviation metrics such as MAD, Standard Deviation, ATR, Z-Score, IQR, or Mean AD relative to customizable moving averages.

View on GitHub

GitHub stars46on the repository
Pine versionv5runs as is
Lines of code366
Settings38inputs
LicenceNone stated
Last update7 weeks ago4 Sep 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.

Overview

Deviation Based Reversion with Stats applies optional volume spike thresholds and trend filters to generate bullish and bearish reversion setups directly on the price chart. Additionally, the indicator tracks signal performance by evaluating price progression over a set look-forward period against custom success and failure targets.

Details

Published by

TamaraKGreen on GitHub

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Mean reversion, Moving averages, Volatility & bands

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Lookback Periodint20bull_length
Enable Trend Filterbooltruebull_trendFilter
Cooldown Period (Bars)int10bull_cooldownBars
Deviation MeasurestringMADbull_deviation_type
Deviation Multiplierfloat2.7bull_madMult
Volume Avg Periodint14bull_volLength
Volume Spike Thresholdfloat1.7bull_volThreshold
Look-Forward Barsint7bull_lookForwardBars
Success Thresholdfloat20.0bull_successThreshold
Failure Thresholdfloat20.0bull_failureThreshold
Threshold TypestringPointsbull_successThresholdType
Conviction Arrow Colorcolorcolor.bluebullish_conviction_color
Show all 38 settings
SettingTypeDefaultVariable
MA TypestringT3bull_ma_type
ALMA Offsetfloat6bull_alma_offset
ALMA Sigmafloat0.85bull_alma_sigma
TVMA Length (>1)int3bull_tvma_length
T3 Factorfloat0.7bull_t3_factor
KAMA Fast EMA Lengthint2bull_kama_fast_len
KAMA Slow EMA Lengthint30bull_kama_slow_len
Lookback Periodint8bear_length
Enable Trend Filterbooltruebear_trendFilter
Cooldown Period (Bars)int10bear_cooldownBars
Deviation MeasurestringMADbear_deviation_type
Deviation Multiplierfloat2.0bear_madMult
Volume Avg Periodint14bear_volLength
Volume Spike Thresholdfloat1.5bear_volThreshold
Look-Forward Barsint5bear_lookForwardBars
Success Thresholdfloat20.0bear_successThreshold
Failure Thresholdfloat20.0bear_failureThreshold
Threshold TypestringPointsbear_successThresholdType
Convexity Arrow Colorcolorcolor.purplebearish_conviction_color
MA TypestringEMAbear_ma_type
ALMA Offsetfloat6bear_alma_offset
ALMA Sigmafloat0.85bear_alma_sigma
TVMA Length (>1)int3bear_tvma_length
T3 Factorfloat0.7bear_t3_factor
KAMA Fast EMA Lengthint2bear_kama_fast_len
KAMA Slow EMA Lengthint30bear_kama_slow_len
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

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]

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

This indicator classifies price action into four distinct market regimes: Trend, Expansion, Compression, or Mean Reversion. It determines states using a simplified Hurst exponent estimate, ADX slope thresholds, and realized volatility measurements. Based on th

Indicator v6 TrendVolatility & bands
Updated 8 weeks ago · MIT GitHub repository of Capital41 Regime Matrix v3
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

This indicator builds a channel from a Hull moving average of the source and an ATR scaled by a band multiplier, then normalizes price inside that channel into a 0 to 100 oscillator. It smooths the result with a weighted moving average and plots the line in a

Indicator v6 Mean reversionVolatility & bands
Updated 3 months ago · None stated GitHub repository of Radiant Mean Reversion Channels [Pineify]

Hampel Filter

by everget
948 stars

The Hampel Filter indicator identifies and filters out price outliers to smooth price data directly on the main chart. It calculates the rolling median and Median Absolute Deviation (MAD) of the chosen source series over a specified length. When a data point e

Indicator v4 Moving averagesVolatility & bands
Updated 10 days ago · GPL-3.0 GitHub repository of Hampel Filter

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers