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?
Dispersion Scaling Rotation is an MT5 expert advisor built around a single statistical measurement called the anomalous-diffusion exponent (often written as alpha), combined with a volatility-adaptive ATR (Average True Range) stop. Rather than relying on classic chart indicators, moving averages, or price-action patterns, it treats the log-price of a market as the position of a diffusing particle and asks one question: over several timescales at once, is price spreading out faster or slower than a plain random walk would predict? That measurement decides whether the strategy behaves as a trend follower or a mean-reversion fader.
The core idea comes from physics. In ordinary diffusion, the mean-squared displacement (how far a particle drifts, squared and averaged) grows in direct proportion to the time you wait. Financial order flow bends that relationship. When displacement compounds faster than a random walk (alpha above 1, "super-diffusive"), price is behaving ballistically and a directional move may be underway. When displacement is suppressed (alpha below 1, "sub-diffusive"), price is acting "caged" and stretched moves may snap back. When alpha sits near 1, there is no exploitable structure and the strategy stands aside.
This EA is best understood as a learning tool for traders curious about regime detection and adaptive systems. It is designed for liquid markets — major forex pairs, metals, indices, and crypto — where a diffusion picture of price is meaningful. It suits students who want to study how one measurement can rotate an algorithm between trending and reverting behavior, rather than anyone seeking a fixed, one-size-fits-all setup.
How It Works
The strategy evaluates the market once per newly closed bar. On each new bar it measures the diffusion exponent across the lags 1, 2, 4, and 8 bars, fits a straight line through the log-log scaling points, and reads the slope as alpha. Everything that follows is a rotation around that number.
- Regime classification: The strategy signals a super-diffusive (trend) state when alpha rises at least
ScalingBandabove 1.0, and a sub-diffusive (revert) state when alpha falls at leastScalingBandbelow 1.0. Inside that neutral band around 1.0, it takes no position. - Trend entry (super-diffusive): The strategy measures the net displacement (drift) over the last
DriftSpanbars. If that drift clearsDriftAtrFrac× ATR, it enters with the drift — long if price moved up, short if price moved down. The ATR filter is there so the system rides a real ballistic move rather than microstructure noise. - Reversion entry (sub-diffusive): The strategy standardizes the latest close against the window's mean and spread to form a z-score (how many standard deviations price sits from its recent average). If the z-score reaches
RevertZScore, it fades the extreme — selling a stretched-up market and buying a stretched-down one, expecting a snap back toward the "cage" center. - Stop-loss logic: Every trade uses a volatility-adaptive stop set at
AtrSlMult× ATR away from entry. Because the stop scales with current ATR, it automatically widens in volatile conditions and tightens in calm ones. - Take-profit logic: The reward-to-risk multiple is a function of the measured exponent. In a strongly super-diffusive regime the target widens (up to roughly 3× the stop distance), because a more ballistic medium is expected to travel further. In a sub-diffusive regime the target is held tighter (as low as roughly 0.6× the stop), because a snappier cage is expected to revert quickly.
- Adaptive regime-flip exit: If a position is open and the freshly measured diffusion state now argues for the opposite direction, the strategy closes the position rather than waiting for the stop. Otherwise, it lets the stop-loss and take-profit do their work.
- One position at a time: The EA manages a single position per symbol under its own magic number, so signals do not stack.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| Window | 60 | 32 | 160 | Analysis window in bars over which the mean-squared displacement and the z-score are measured. |
| ScalingBand | 0.15 | 0.03 | 0.5 | Neutral half-band around alpha = 1. The exponent must deviate by more than this before the strategy acts. |
| DriftSpan | 4 | 1 | 20 | Number of bars spanned by the net displacement (drift) used in the trend regime. |
| DriftAtrFrac | 0.30 | 0.0 | 2.0 | The drift must exceed this fraction of ATR to count as a genuine ballistic move. |
| RevertZScore | 1.20 | 0.5 | 3.0 | Z-score extreme required to fade price in the sub-diffusive (reversion) regime. |
| AtrPeriod | 14 | 7 | 40 | Number of bars used to compute the ATR that drives stop and target distances. |
| AtrSlMult | 2.0 | 0.8 | 5.0 | Stop-loss distance as a multiple of ATR. |
| Lots | 0.10 | 0.01 | 1.0 | Fixed trade size in lots. |

Recommended Chart Settings
Dispersion Scaling Rotation runs on a single primary timeframe — whichever chart you attach it to at test time. There is no hard-coded symbol or period, which makes it flexible but also means the defaults are only a starting point. As a practical study setup, attach it to a liquid instrument such as EUR/USD, XAU/USD (gold), or a major index on an intraday-to-swing timeframe like M15, M30, or H1, where the diffusion behavior of price tends to be cleaner and spreads stay reasonable relative to ATR-based stops.
Because the strategy measures scaling across the 1, 2, 4, and 8-bar lags, its character changes with the timeframe you choose: the same market can read as super-diffusive on one period and sub-diffusive on another. Treat every timeframe and symbol as a separate experiment. Results will vary meaningfully across different instruments and market conditions, so test each combination independently rather than assuming one calibration transfers to another.
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 appeal of this approach is that it does not assume a single, fixed edge. The same machinery trends in one regime and reverts in another, self-adapting to the measured diffusion character of price instead of forcing a trend model onto a ranging market or vice versa. The ATR-based stops and exponent-scaled targets also give it a coherent, volatility-aware risk framework, and the regime-flip exit means it will not stubbornly hold a position once the statistics turn against it.
That said, the method has real limitations you should understand. The diffusion exponent is a statistical estimate from a limited window, so it is noisy — especially with a short Window — and can flip regimes on borderline readings, producing whipsaws. During choppy, low-volatility periods, alpha may hover inside the neutral band and the EA will simply do nothing for long stretches, which can feel like underperformance but is by design. In the reversion regime, fading a statistical extreme historically carries the classic risk that a "stretched" market keeps stretching — a strong trend can run well past any z-score threshold before it reverts, if it reverts at all.
Transaction costs matter too. Because the strategy can act every new bar and includes an adaptive exit, spreads, commissions, and slippage may erode edges that look clean in a frictionless backtest. It has no news filter, no session filter, and no equity-based circuit breaker, so it will trade through high-impact events unless you add those guardrails yourself. Think of it as a framework to study and stress-test, not a finished, hands-off system.
Risk Management Tips
Sound risk management matters far more than any single entry rule. Consider these general principles as you study this or any EA:
- Size positions deliberately. The fixed
Lotsdefault is a placeholder. Many educational sources suggest risking no more than 1–2% of account equity on a single trade; translate that into a lot size that matches yourAtrSlMult× ATR stop distance and your account balance. - Start on a demo account. Run the EA on a demo or a small test account across varied conditions before considering any live capital. This lets you observe how often it trades and how it behaves through both trending and ranging phases.
- Understand drawdown. Every strategy endures losing streaks. Know the largest peak-to-trough decline you can tolerate, both financially and emotionally, before you begin.
- Test each market separately. Because behavior shifts by symbol and timeframe, validate every combination independently and re-check periodically as market regimes evolve.
- Keep leverage modest. Lower effective leverage gives volatility-adaptive stops room to work without threatening the account on a single adverse move.
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: DispersionScalingRotation.ex5 (0 downloads)
- Source Code: DispersionScalingRotation.mq5 (0 downloads)
- Documentation: DispersionScalingRotation.pdf (0 downloads)