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 Adaptive Serial Correlation Switch is an algorithmic MetaTrader 5 (MT5) strategy built around a single statistical measurement: the lag-1 autocorrelation of returns. Rather than relying on chart patterns, moving averages, support and resistance, or discretionary "smart money" concepts, it treats the stream of bar-to-bar price changes as a raw stochastic process and asks one question on every completed bar — is the market currently persistent (trending) or anti-persistent (mean-reverting)? Autocorrelation is simply a measure of how strongly a value is related to the value that came before it; here it is applied to log returns, the natural logarithm of each bar's close divided by the previous close.
Because this single number can drift from positive to negative over time, the strategy is designed to switch behavior automatically. When the recent returns tend to repeat their direction, it trades with the latest impulse (trend-following). When recent returns tend to reverse, it trades against the latest impulse (mean reversion). When the signal sits inside a defined "dead zone," it simply stands aside. This makes it a self-adapting regime classifier rather than a fixed directional system.
As a learning tool, the Adaptive Serial Correlation Switch is well suited to traders and students who want to understand statistical thinking applied to markets — regime detection, volatility-adaptive filters, and conviction-scaled risk. It is intended for study and analysis on liquid instruments such as major forex pairs, metals, or crypto, and this article frames it as a strategy analysis, not a profit opportunity.
How It Works
The strategy evaluates the market once per newly-closed bar. On each closed bar it performs the following steps:
- Measure the regime (autocorrelation). It calculates the lag-1 autocorrelation coefficient (
rho) of the lastCorrWindowlog returns. This value is bounded between -1 and +1 and is invariant to price scale. Its sign classifies the local market regime. - Classify persistence. If
rhois greater than+RegimeThreshold, the market is treated as persistent (trend microstructure). Ifrhois less than-RegimeThreshold, it is treated as anti-persistent (mean-reverting microstructure). Ifrhosits between those bounds, the reading is considered noise and no trade is taken. - Measure the recent impulse. It calculates the recent directional move as the difference between the last closed bar's close and the close
ImpulseSpanbars earlier, expressed in price units so it is directly comparable to the Average True Range (ATR) — a common volatility measure. - Apply a volatility gate. The impulse only counts as a valid signal if its absolute size exceeds
ImpulseAtrFrac× ATR. This filters out microstructure noise so the strategy responds only to moves that are meaningful relative to current volatility. - Decide direction. When a fresh impulse passes the gate: in a persistent regime the strategy signals a trade in the same direction as the impulse; in an anti-persistent regime it signals a trade in the opposite direction (fading the move).
For risk and trade management:
- Stop-loss logic. The stop is placed a fixed ATR multiple away from entry, set by
AtrSlMult. Long trades place the stop below entry; short trades place it above. - Take-profit logic (conviction-scaled). The take-profit distance is an ATR multiple that grows with the strength of the signal. It starts from
AtrTpMultand is scaled up by the magnitude ofrho, so higher-confidence regimes aim for proportionally larger targets. - Adaptive regime-flip exit. If a position is open and the measured regime later argues the opposite direction, the strategy closes the position rather than waiting for the stop or target. Otherwise, it lets the stop-loss and take-profit manage the trade.
- One position at a time. The strategy manages a single position per symbol, identified by its magic number, and will not stack new entries while one is open.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| CorrWindow | 30 | 10 | 100 | Number of log returns (N) used in the autocorrelation window. Larger values smooth the regime reading; smaller values react faster. |
| ImpulseSpan | 3 | 1 | 10 | Number of bars (k) spanned by the "recent impulse" measurement that defines trade direction. |
| RegimeThreshold | 0.15 | 0.0 | 0.6 | Dead-zone theta. The absolute autocorrelation must exceed this before a trending or reverting regime is declared. |
| ImpulseAtrFrac | 0.25 | 0.0 | 1.5 | The impulse must exceed this fraction of ATR to be treated as a valid, non-noise signal. |
| AtrPeriod | 14 | 7 | 40 | Number of bars used to compute the ATR volatility measure. |
| AtrSlMult | 2.0 | 0.8 | 5.0 | ATR multiple used to set the stop-loss distance from entry. |
| AtrTpMult | 3.0 | 1.0 | 6.0 | Base ATR multiple for the take-profit before conviction scaling. |
| Lots | 0.10 | 0.01 | 1.0 | Fixed trade volume in lots per position. |

Recommended Chart Settings
The Adaptive Serial Correlation Switch operates on a single primary timeframe — whatever chart it is attached to at run time — and does not reference higher or lower timeframes. It is designed for liquid instruments where returns are well-behaved and spreads are tight, such as major forex pairs (for example EUR/USD or GBP/USD), metals like gold (XAU/USD), or major crypto pairs.
There is no single "correct" timeframe; the autocorrelation logic can be studied across many, from intraday charts such as M15 and H1 up to H4 and daily. Because the strategy measures serial dependence that genuinely varies by instrument and timeframe, results will vary meaningfully across different markets and market conditions. Treat the default parameters as a starting point for study and always test on your own data before drawing conclusions.
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 that it does not assume a fixed edge. Most retail systems are permanently trend-following or permanently mean-reverting, and they suffer whenever the market switches character. By measuring serial correlation directly, the Adaptive Serial Correlation Switch attempts to adapt to whichever regime is currently present. The volatility-adaptive impulse gate and the conviction-scaled take-profit are also thoughtful touches: the strategy tries to act only on meaningful moves and to size its ambitions to the strength of the signal.
That said, this method has real limitations you should understand:
- Autocorrelation is noisy. Lag-1 autocorrelation estimated over a few dozen returns is a statistically shaky quantity. It can flip sign frequently, and a small window may produce whipsaw signals while a large window may lag genuine regime changes.
- Regimes are not persistent. A market that was mean-reverting can become trending within the same session. The strategy detects this only after enough new bars accumulate, so it may be late at transitions.
- Costs matter. Because the logic reacts to short-horizon impulses, it can trade relatively often. Spreads, commissions, and slippage can materially affect outcomes, especially on lower timeframes or less liquid symbols.
- Parameter sensitivity and overfitting. With eight parameters, it is easy to tune the strategy to look excellent on historical data and then behave very differently going forward. Guard against this by testing across multiple periods and instruments.
- Choppy, low-volatility conditions. When the market has no clear serial structure,
rhowill hover near zero and the strategy will often stand aside — but noisy readings near the threshold can still produce marginal trades.
This is best viewed as an educational framework for studying market regimes, not a finished product to deploy unexamined.
Risk Management Tips
Sound risk management matters more than any single entry rule. As you study this strategy, keep these general principles in mind:
- Risk a small, fixed fraction per trade. A common educational guideline is risking no more than 1–2% of account equity on any single position. Adjust the
Lotsparameter and your account size so the ATR-based stop distance stays within that limit. - Understand drawdown. Even a statistically sound system experiences losing streaks. Study the maximum peak-to-trough decline in your tests and ask whether you could tolerate it emotionally and financially.
- Use a demo account first. Run the strategy on a demo or paper account long enough to observe how it behaves across different regimes before considering any live capital.
- Size positions deliberately. Position sizing, not prediction, is what keeps a losing streak survivable. Never increase size to "win back" losses.
- Test across conditions. Validate behavior over trending, ranging, high-volatility, and quiet periods — and across more than one instrument — so you are not relying on a single favorable stretch of history.
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: AdaptiveSerialCorrelationSwitch.ex5 (0 downloads)
- Source Code: AdaptiveSerialCorrelationSwitch.mq5 (0 downloads)
- Documentation: AdaptiveSerialCorrelationSwitch.pdf (0 downloads)