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?
Spread Exhaustion Reversion is a mean-reversion trading strategy built around the Corwin-Schultz (2012) high-low effective-spread estimator — a piece of market microstructure that most chart-based systems ignore entirely. In plain terms, the Corwin-Schultz estimator infers the implied bid-ask spread of a market using nothing but the high and low ranges of two consecutive price bars. No tick data, no order-book feed, and no volume are required. That makes it unusually robust on instruments where reported tick volume is unreliable.
The core idea is that a bar's high tends to be transacted near the ask (a buy) while its low tends to be near the bid (a sell), so an individual bar's high-low range is inflated by the spread. By comparing the ranges of two single bars against the combined two-bar range, the estimator "backs out" an implied spread. When that implied spread suddenly spikes, it signals that the two-bar range blew out relative to the individual bars — a classic signature of a thin-book stress event, a stop-run, or a short-lived liquidity vacuum. Historically, such dislocations tend to be transient: liquidity providers step back in and price is drawn back toward fair value.
This strategy is best treated as a learning tool for traders who want to understand microstructure-based mean reversion. It is designed for liquid instruments during conditions where price becomes over-stretched from its average and then snaps back. It is not a trend-following system, and it is not intended for one-directional runaway markets. If you are studying how illiquidity events and spread dynamics can be translated into a systematic, self-scaling entry filter, this is a strong educational example.
How It Works
The strategy acts only on a freshly closed bar of the chart's primary timeframe. It maintains a rolling history of highs, lows, and closes, and it computes the Corwin-Schultz estimated spread for each new bar. Three conditions must align before a trade is signalled.
- Fair-value baseline: An Exponential Moving Average (EMA) — a moving average that weights recent prices more heavily — defines the "fair value" that price is expected to revert toward. The signed distance between the latest close and the EMA is called the stretch.
- Volatility scaling: The Average True Range (ATR) — a measure of typical bar-to-bar range — scales both the stretch requirement and the protective stop, so the system adapts automatically to calm or volatile conditions.
- Illiquidity spike test: The current estimated spread is compared against a rolling z-score of its own recent history. A spike is confirmed only when the current spread exceeds the mean plus
SpreadSpikeMultstandard deviations of the prior window. This is the microstructure trigger.
The strategy signals entries as follows:
- Long (buy): The estimated spread spikes above its recent norm and price has closed at least
StretchMult × ATRbelow the EMA baseline (over-stretched to the downside). The strategy signals a buy, places the stop below the spike bar's low, and sets a take-profit a number of ATRs above the entry. - Short (sell): The estimated spread spikes the same way and price has closed at least
StretchMult × ATRabove the EMA baseline (over-stretched to the upside). The strategy signals a sell, places the stop above the spike bar's high, and sets a take-profit a number of ATRs below the entry.
Exit logic is deliberately simple and thesis-driven:
- Baseline reclaim (early exit): If an open long closes back at or above the EMA baseline, or an open short closes back at or below it, the position is closed immediately — the reversion has played out and there is no reason to stay.
- Take-profit: A fixed target set at
TpAtrMult × ATRfrom the entry price. - Stop-loss: Placed
SlAtrMult × ATRbeyond the extreme of the spike bar, so the risk sits just past the point where the dislocation occurred.
Two additional guards keep the system disciplined: only one position per magic number is held at a time, and new entries are skipped whenever the live broker spread is wider than MaxSpreadPoints, avoiding entries during genuinely expensive execution windows.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| EmaPeriod | 50 | 20 | 200 | Period of the EMA baseline that defines fair value and the reversion target. |
| AtrPeriod | 14 | 5 | 40 | ATR lookback used for both the stretch gate and the protective stop distance. |
| StretchMult | 1.5 | 0.5 | 4.0 | How far (in ATRs) price must stretch away from the EMA before a fade is allowed. |
| SpreadLookback | 50 | 20 | 200 | Rolling window over which the estimated-spread spike (z-score) is measured. |
| SpreadSpikeMult | 1.5 | 0.5 | 4.0 | Spike threshold: the estimated spread must exceed the mean plus this many standard deviations. |
| SlAtrMult | 1.2 | 0.5 | 4.0 | Protective stop distance beyond the spike bar's extreme, in ATRs. |
| TpAtrMult | 2.0 | 0.5 | 6.0 | Take-profit distance from entry, in ATRs. |
| MaxSpreadPoints | 80 | 5 | 300 | Skip new entries when the live broker spread (in points) is wider than this. |
| Lots | 0.10 | 0.01 | 1.0 | Fixed trade size in lots. |
| Magic | 20732 | 0 | 9,999,999 | Unique magic number used to identify and manage this EA's positions. |

Recommended Chart Settings
Spread Exhaustion Reversion was designed with a liquid FX major or metal — such as EURUSD or XAUUSD — on the M5 to M30 timeframes in mind. These instruments have well-behaved high-low ranges, which is what the Corwin-Schultz estimator depends on, and the intraday timeframes are where transient illiquidity spikes and quick reversions to fair value tend to occur most often.
That said, the code itself uses only the timeframe selected at attach or backtest time (the chart's primary timeframe), so you are free to experiment. Keep in mind that results will vary considerably across different symbols, brokers, and market conditions, and any parameter set that looks favourable on one instrument may behave very differently on another. Treat the defaults as a starting point for study, not a finished configuration.
How to Install on MetaTrader 5
- Download the
.ex5file 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 main strength of this approach is its data efficiency and independence from volume. Because the Corwin-Schultz estimator needs only OHLC data, it sidesteps the notoriously unreliable tick-volume feeds that plague retail FX platforms. Unlike volume-based illiquidity measures such as Amihud or VPIN, the spread-based signal here remains meaningful even on symbols where volume cannot be trusted. The system is also fully self-scaling: the spike test is a rolling z-score, the stretch and stops are ATR-based, and the strategy caps itself at one position at a time — all of which impose useful discipline.
There are real limitations to understand, however. Mean-reversion systems are vulnerable to strong, persistent trends: a market that keeps stretching further from the EMA can trigger a fade that then runs against the position until the stop is hit. The baseline-reclaim exit helps by cutting losers early when price fails to revert, but it does not eliminate the risk. The Corwin-Schultz estimator is also a statistical approximation of the spread, not a direct measurement — it can produce noisy or negative outputs (which the code floors at zero), and its accuracy depends on reasonably clean OHLC data. During news spikes, gaps, or illiquid sessions, the estimator can misfire.
You should also recognise that this strategy tends to underperform in quiet, low-volatility regimes where genuine illiquidity spikes are rare, and in high-volatility trending markets where dislocations do not revert. It is at its most coherent in choppy, range-bound conditions punctuated by occasional stress events. As with any single-logic system, avoid over-optimising the parameters to a specific historical window — a configuration that fits the past perfectly often generalises poorly.
Risk Management Tips
Sound risk management matters more than any single entry signal. Consider the following educational principles:
- Position sizing: Size trades so that a stop-out costs only a small, predefined fraction of your account. A common guideline is to risk no more than 1–2% of account equity per trade.
- Respect the stop: This strategy places an ATR-based stop for a reason. Removing or widening it manually defeats the risk framework built into the system.
- Test on a demo account first: Run the EA on a demo account across varied market conditions before considering any live deployment, so you can observe its behaviour without financial exposure.
- Understand drawdown: Every strategy experiences losing streaks. Study the depth and duration of drawdown you might face, and be honest about whether you could tolerate it emotionally and financially.
- Diversify your study: Avoid concentrating everything into one instrument or one strategy. Treat this EA as one component of a broader learning process, not a standalone solution.
By combining conservative sizing, disciplined stops, and thorough demo testing, you give yourself the best chance of understanding how — and whether — a strategy like this fits your own approach.
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: SpreadExhaustionReversion.ex5 (45 downloads)
- Source Code: SpreadExhaustionReversion.mq5 (46 downloads)
- Documentation: SpreadExhaustionReversion.pdf (48 downloads)