Mean Reversion
May 6, 2023

The Mean Reversion indicator identifies potential trade opportunities by detecting significant price deviations from the long-term average using a combination of Exponential Moving Averages (EMA), Average True Range (ATR), and Bollinger Bands.
Usage
The indicator is used to spot oversold and overbought conditions where price is likely to revert to its mean.
- Buy Signals: Occur when the price is below the EMA by a specific volatility-adjusted distance (ATR * factor) and simultaneously closes below the lower Bollinger Band.
- Sell Signals: Occur when the price is above the EMA by a specific volatility-adjusted distance and simultaneously closes above the upper Bollinger Band.
Traders can use these signals to enter mean reversion trades when price has reached an exhaustive state relative to its historical volatility and trend.
Details
The script functions by measuring the "stretch" of the price away from a central baseline. It uses two primary filters to define an extreme deviation:
- Volatility Distance: It calculates a dynamic threshold based on the ATR. By multiplying the ATR by a user-defined distance factor, the script ensures that signals only appear when the price moves further than standard market noise.
- Statistical Envelope: Bollinger Bands are utilized to provide a standard deviation-based boundary. The confluence of the price being significantly far from the 200 EMA and outside the Bollinger Bands serves as a high-probability filter for mean reversion setups.
Settings
Inputs
- ATR Length: Sets the lookback period for the Average True Range calculation used to measure volatility.
- EMA Length: Sets the period for the baseline Exponential Moving Average (default is 200).
- BB Length: Determines the period for the Bollinger Bands' basis line (SMA).
- BB Deviation: Sets the number of standard deviations for the Bollinger Band width.
- EMA Buy Distance: A multiplier for the ATR that defines how far below the EMA the price must be to trigger a buy signal.
- EMA Sell Distance: A multiplier for the ATR that defines how far above the EMA the price must be to trigger a sell signal.
FAQ
How do I interpret the buy and sell labels?
The "Buy" triangle appears when the price is significantly extended below the mean and the lower Bollinger Band, suggesting a potential bounce. The "Sell" triangle appears when the price is extended above the mean and the upper Bollinger Band, suggesting a potential pullback.
Can I change the sensitivity of the signals?
Yes, you can adjust the EMA Buy/Sell Distance and the BB Deviation settings. Increasing these values will result in fewer, more selective signals, while decreasing them will result in more frequent signals.
How can I access the Mean Reversion indicator?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.