Blog / Strategy
Strategy

Half Life Reversion Fade

Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy — including backtests — does not guarantee future results. Never trade with money you cannot afford to lose.

What Is This Strategy?

The Half Life Reversion Fade is a mean-reversion strategy built around an Ornstein-Uhlenbeck (OU) process — a statistical model of how a value drifts away from and then gets pulled back toward its average. Instead of blindly fading every price spike, this strategy first measures how quickly the market is actually reverting, then only trades when that reversion is fast and reliable. Its trading style is short-term, statistics-driven mean reversion on a single timeframe.

Most simple fade systems fire whenever price stretches a certain distance from its average — a z-score or Bollinger Band touch, for example. The problem is that the same "extreme" reading looks identical whether the market is genuinely oscillating around a mean or grinding away in a trend. Fading a trend is where these systems quietly bleed. The Half Life Reversion Fade adds a regime gate: it fits an AR(1) autoregression to recent closes to estimate the reversion half-life — the number of bars it historically takes for a deviation to shrink by half — and only takes a trade when that half-life is short.

As a learning tool, this strategy is well suited to traders who want to understand the difference between unconditional and conditional mean reversion, and who are curious about how concepts from quantitative finance — half-life, autoregression, and z-scores — translate into concrete entry and exit rules. It is a study in filtering, not a shortcut. Treat it as a framework for exploring when fading extremes may make statistical sense and when standing aside is the wiser choice.

How It Works

The strategy evaluates the market once per closed bar. On each new bar it rebuilds a rolling window of recent closes and runs a short statistical pipeline before deciding whether any trade is warranted.

half life mean reversion EA
Illustrative example of the strategy’s entry and exit logic — not real trading results.

Strategy Parameters

Parameter Default Min Max Description
RegPeriod 40 20 120 Number of closed bars used to fit the OU/AR(1) regression window and compute the mean and standard deviation.
EntryZ 2.0 1.0 3.5 The z-score stretch (in standard deviations) required before the strategy fades the extreme. Higher values demand a larger deviation.
MaxHalfLife 20.0 5.0 60.0 Maximum acceptable reversion half-life, in bars. Trades are only taken when the measured half-life is at or below this value.
AtrPeriod 14 5 30 Lookback period for the ATR calculation used to size the stop-loss distance.
AtrStopMult 2.0 0.5 5.0 Multiplier applied to ATR to place the stop-loss beyond the extreme. Larger values give the trade more room.
Lots 0.10 0.01 1.0 Fixed order volume (position size) in lots for each trade.
half life mean reversion EA — MQL5 source code

Recommended Chart Settings

The Half Life Reversion Fade is written to read everything from the primary timeframe selected at runtime, so it will run on whatever chart you attach it to. Mean-reversion logic tends to be studied most naturally on intraday timeframes such as M15, M30, or H1, where ranging behavior between session extremes is common, and on liquid instruments with a clear tendency to oscillate — major forex pairs like EUR/USD are a common starting point for this style of analysis.

Because the strategy adapts its window and thresholds to the timeframe you choose, the "right" settings depend heavily on the instrument's character. Results will vary considerably across symbols, sessions, and market conditions. Always test a specific symbol-and-timeframe combination in the Strategy Tester before drawing any conclusions, and re-evaluate whenever the market's behavior shifts.

How to Install on MetaTrader 5

What to Consider Before Using This EA

The core strength of this approach is its selectivity. By requiring a statistically confirmed, fast-reverting regime before fading anything, it aims to avoid the classic mean-reversion trap of shorting strength into a runaway trend. The half-life gate is a disciplined, data-driven filter, and the ATR stop keeps the loss on a failed fade bounded and volatility-aware. For a learner, the code is also a clean, readable example of how autoregression and z-scores can be combined into a coherent rule set.

The limitations are equally important to understand. The AR(1) half-life is an in-sample estimate — it describes how the window behaved historically and offers no promise about the next bar. Regimes can flip abruptly: a market can pass the reversion gate and then break out immediately after entry, which is precisely why the ATR stop exists. Mean-reversion faders also tend to win often but small (targeting the mean) and lose occasionally but larger (a breakout that runs to the stop), so the distribution of outcomes can feel lopsided and psychologically challenging. During strong trending phases the strategy may simply refuse to trade for long stretches — that is the gate working as designed, but it can be frustrating if you expect constant activity. Finally, spread and slippage matter more for short-target reversion trades than for trend systems, since the take-profit distance is relatively small.

Risk Management Tips

Sound risk management matters far more than any single entry rule. Consider these general principles as you study this strategy:

Risk Warning

Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.

Downloads

← Back to Blog