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.
- Fit the reversion model. Across the regression window, the strategy regresses each bar's one-bar price change on the prior price level (
dX = alpha + beta * X_prev). The slopebetadescribes whether deviations get pulled back. A negative beta means the level is being tugged toward its mean — the signature of a mean-reverting regime. - Measure the half-life. From the AR(1) coefficient
phi = 1 + beta, the strategy computes the reversion half-life as-ln(2) / ln(phi), expressed in bars. A short half-life means deviations historically collapsed quickly; a long one means slow, unreliable reversion. - The regime gate. If
betais zero or positive (a trending or random-walk regime), the strategy stands aside entirely — no trade. If the half-life is longer than theMaxHalfLifethreshold, it also stands aside. Only a short, confirmed half-life unlocks trading. This gate is the defining feature that separates this system from a plain band fader. - Measure the stretch. Once the regime is confirmed, the strategy computes a z-score of the latest close — how many standard deviations it sits from the window mean. A large z-score means price is stretched far from its average.
- Long entry. When the regime is confirmed and the z-score is at or below
-EntryZ(price stretched below the mean), the strategy signals a buy, fading the downside extreme. - Short entry. When the regime is confirmed and the z-score is at or above
+EntryZ(price stretched above the mean), the strategy signals a sell, fading the upside extreme. - Take-profit logic. The target is the window mean itself — the strategy expects the stretched price to revert back to its average. If the mean has already been passed relative to entry, a fallback ATR-based target is used instead.
- Stop-loss logic. The stop is placed an ATR (Average True Range) multiple beyond the extreme — below entry for longs, above entry for shorts. ATR measures recent volatility, so the stop adapts to current market conditions. This cuts the primary failure mode quickly: a genuine breakout that keeps extending rather than reverting.
- One position at a time. The strategy holds at most one open position per magic number on the symbol, so signals do not stack.

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. |

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
- Download the .ex5 file from the link below
- Copy it to your MT5
MQL5\Expertsfolder - Restart MetaTrader 5 or refresh the Navigator panel
- Drag the EA onto a chart matching the recommended symbol and timeframe
- Configure the input parameters and enable Algo Trading
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 a small, fixed fraction per trade. Many educational sources suggest never risking more than 1–2% of account equity on any single position. Size your lots so the distance to the ATR stop equates to that fraction, rather than trading a fixed lot blindly.
- Understand drawdown. Even a strategy with a favorable historical profile will experience losing streaks. Know how large a drawdown you can tolerate — financially and emotionally — before you begin.
- Start on a demo account. Run the EA on a demo or in the Strategy Tester until you understand how it behaves across ranging and trending conditions. Observe how often the regime gate blocks trades.
- Account for costs. Include realistic spread, commission, and slippage in any evaluation. Small take-profit targets are especially sensitive to these frictions.
- Never over-leverage. Leverage amplifies both gains and losses. Keep position sizes conservative relative to your account balance.
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
- Expert Advisor: HalfLifeReversionFade.ex5 (30 downloads)
- Source Code: HalfLifeReversionFade.mq5 (28 downloads)
- Documentation: HalfLifeReversionFade.pdf (34 downloads)