All indicators

Mean Reversion Strategy v2 [KL]

Oct 28, 2021

Static chart image
SignalsMoney ManagementTrailing-StopVolatility

The Mean Reversion Strategy v2 [KL] indicator identifies potential trade entries by detecting significant diversions in volatility and confirming them with trend prediction models.

Usage

The strategy enters a long position when two primary conditions are met:

  1. Volatility Diversion (Main Signal): The script monitors the Average True Range (ATR). When the short-term (fast) ATR significantly deviates from the long-term (slow) ATR, it signals that current volatility has reached an extreme relative to its mean.
  2. Trend Confirmation: To ensure the trade aligns with market direction, the strategy calculates the "Drift" (expected logarithmic return). A long entry is only triggered if this drift curve is upward sloping.

The script includes a built-in trailing stop loss and a multi-level take-profit system to manage risk and lock in gains as the price moves in the expected direction.

Details

This strategy is an evolution of mean reversion concepts, specifically focusing on volatility normalization. Unlike the previous version which used simple standard deviation bands, version 2 implements a two-tailed hypothesis test. This method accounts for Standard Error (SE) to determine if the difference between fast and slow ATR values is statistically significant. By rejecting the null hypothesis (that the two averages are equal) only when the test statistic exceeds a specific critical value, the strategy aims to reduce noise and provide more accurate entry signals.

Settings

Hypothesis testing

  • Length of ATR (fast) for diversion test: Sets the lookback period for the short-term volatility measurement.
  • Length of ATR (slow) for diversion test: Sets the lookback period for the baseline volatility measurement.
  • Confidence Interval: Choose between 90%, 95%, or 99%. This determines the critical value threshold for the hypothesis test.

Stop loss

  • ATR Multiplier for trailing stop loss: Determines the distance of the trailing stop based on volatility.
  • Length of ATR for trailing stop loss: The lookback period used to calculate the ATR for risk management.

Trend prediction

  • Length of drift: The lookback period for calculating the logarithmic return and its variance to determine the trend slope.

Order size and Profit taking

  • Allocation (%) of portfolio: The percentage of undrawn capital to risk per trade.
  • Take profit at different levels: Enables or disables the three-tier profit-taking system.
  • First/Second/Third level profit: Sets the profit targets relative to the initial risk (R).

FAQ

How do I use the Mean Reversion Strategy v2 [KL]?

Apply the script to your chart and adjust the Hypothesis Testing settings to match the volatility of your chosen asset. It is designed for assets that exhibit clear cyclical volatility.

What is the "Drift" calculation used for?

The Drift is used to determine the underlying trend. By ensuring the drift is upward sloping, the strategy avoids entering mean reversion trades against a strong downward move.

How can I access this tool?

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.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.