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 Spread Regime Breakout strategy is a channel breakout system for MetaTrader 5 that adds an unusual liquidity filter built on the Corwin & Schultz (2012) effective bid-ask spread estimator. Most breakout systems try to separate genuine range breaks from false ones using volume, volatility, or a moving-average filter. This strategy takes a different route: it reconstructs the market's hidden transaction cost — the effective spread — directly from the high-low ranges of recent bars, and only acts on a breakout when that estimated spread is calm.
The core idea rests on a piece of market microstructure research. A single bar's high-low range reflects both the true volatility of the asset and the "bid-ask bounce" — the tiny back-and-forth between the buy price and the sell price. A two-bar range dilutes that bounce. By comparing the two, the Corwin-Schultz method isolates an estimate of the proportional spread. In plain terms, a wide estimated spread suggests a thin, turbulent tape where breakouts often get stop-hunted and reverse, while a tight estimated spread suggests a deep, liquid, orderly market where a genuine range break has real order flow behind it. The strategy therefore stands aside when the tape looks thin and only trusts breakouts when liquidity looks healthy.
As a learning tool, this strategy suits traders who already understand basic breakout logic and want to explore how microstructure concepts — spread, liquidity, and adverse selection — can be turned into a mechanical filter. It is designed for clean, trending or momentum-driven conditions on liquid instruments, and it is volume-free and self-scaling, so it can be studied on any liquid FX pair, metal, index, or crypto CFD. This article is a strategy analysis, not a profit opportunity; the goal is to understand why the rules are shaped the way they are.
How It Works
The Spread Regime Breakout evaluates its rules once per completed bar (it never acts on the still-forming bar, so signals do not repaint). When a bar closes, the strategy runs through the following logic.
Entry conditions:
- Build the Donchian channel. A Donchian channel is simply the highest high and lowest low over a lookback window. The strategy builds it from the bars preceding the just-closed signal bar, so the signal bar itself does not contaminate the channel it must break.
- Check the effective-spread regime. The strategy computes the Corwin-Schultz spread estimate for recent bar-pairs and takes two rolling averages: a short one (recent liquidity) and a long baseline one (normal liquidity). The gate opens only when the recent average spread sits at or below
SpreadRatioMaxtimes the baseline — meaning the effective spread is currently tight relative to its own norm. If the spread is wide, the strategy stands aside. - Confirm direction with a decisive close. If the gate is open and the signal bar closes above the channel high and closes above its own open (a bullish bar), the strategy signals a long. If the signal bar closes below the channel low and below its own open (a bearish bar), it signals a short. Long and short are exact mirror images.
- One position at a time. Only a single position per magic number is held; while a trade is open, no new entries are taken.
Exit conditions, stop-loss, and take-profit:
- ATR-based stop-loss. The stop is placed at
SlAtrMult× ATR away from the entry price. ATR (Average True Range) measures recent volatility, so the stop automatically widens in volatile conditions and tightens in calm ones. - ATR-based take-profit. The target is placed at
TpAtrMult× ATR from entry. With the defaults (1.5 ATR stop, 3.0 ATR target), the structure historically aims for a roughly 1:2 risk-to-reward shape, though realised outcomes will always vary. - Move to breakeven. Once price travels
BreakevenAtr× ATR in the trade's favour, the stop is lifted to the entry price. This is checked on every tick and is designed to reduce the chance of a winning trade turning into a loss. SettingBreakevenAtrto 0 disables this behaviour.
Because both the stop and target are anchored to ATR, the strategy is self-scaling: it adapts its risk distances to whatever instrument and timeframe you attach it to.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| ChannelPeriod | 20 | 10 | 60 | Donchian channel length whose high/low edge the signal bar must decisively close beyond. |
| SpreadWindow | 5 | 2 | 20 | Short window — the recent effective-spread reading representing current liquidity. |
| RegimeLookback | 50 | 20 | 150 | Long window — the baseline effective spread the recent reading is judged against. |
| SpreadRatioMax | 1.00 | 0.50 | 1.50 | Gate threshold: recent spread must be ≤ this fraction of the baseline to allow a trade. |
| AtrPeriod | 14 | 7 | 28 | Averaging period for the ATR used in stop, target, and breakeven distances. |
| SlAtrMult | 1.50 | 0.50 | 4.00 | Stop-loss distance expressed as a multiple of ATR. |
| TpAtrMult | 3.00 | 1.00 | 6.00 | Take-profit distance expressed as a multiple of ATR. |
| BreakevenAtr | 1.00 | 0.00 | 3.00 | Move the stop to entry once price runs this many ATRs in favour (0 disables it). |
| Lots | 0.10 | 0.01 | 1.00 | Fixed trade size in lots. |
Lowering SpreadRatioMax makes the liquidity gate stricter (fewer, more selective trades); raising it loosens the filter. Adjusting ChannelPeriod changes how significant a breakout must be, and the ATR multipliers reshape the risk-reward profile.

Recommended Chart Settings
The Spread Regime Breakout is built for a single timeframe — it operates entirely on the chart timeframe you attach it to. Its clean breakout/momentum character historically suits the M30 to H4 range on liquid instruments such as EURUSD, XAUUSD (gold), or a major stock index CFD.
Higher timeframes tend to produce fewer, more deliberate breakouts and cleaner spread estimates, while lower timeframes generate more signals but are noisier and more sensitive to trading costs. Because the logic is volume-free and self-scaling, you can experiment across instruments — but remember that results will vary substantially across different symbols and market conditions. Always test any configuration on your own broker's data before drawing conclusions, since spreads, tick data, and liquidity differ from one broker 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
Like any mechanical system, the Spread Regime Breakout has strengths and clear limitations worth understanding before you rely on it.
Strengths:
- A microstructure filter with a rationale. Rather than adding yet another lagging indicator, the effective-spread gate targets a genuine cause of false breakouts — thin, high-cost, adverse-selection conditions. This is an educational way to see how academic microstructure research can be operationalised.
- Self-scaling risk. ATR-anchored stops and targets adapt automatically to each instrument's volatility, and the breakeven mechanism aims to protect trades that move in your favour.
- No repainting. Signals are evaluated only on completed bars, so what you see in a backtest reflects what would have been decided live.
Limitations and weaker conditions:
- Breakout strategies struggle in ranges. In choppy, sideways markets, breakouts frequently fail. Even a good liquidity filter cannot rescue a market that has no directional follow-through, so expect a series of small losses during range-bound phases.
- The Corwin-Schultz estimate is an approximation. It is a statistical proxy for the spread derived from high-low ranges, not the true quoted spread. On gapping instruments, during news, or on illiquid symbols it can behave erratically, and negative single-bar estimates are floored to zero.
- Parameter sensitivity. The gate ratio, channel length, and ATR multipliers interact. Aggressive optimisation on historical data can produce curve-fitted settings that fail out-of-sample.
- Fixed lot sizing. The
Lotsinput does not scale to account equity, so position size must be managed deliberately.
This is a tool for study and disciplined testing, not a set-and-forget solution. Treat every parameter as a hypothesis to be examined, not a guarantee.
Risk Management Tips
Sound risk management matters far more than any single entry rule. Whatever strategy you study, keep these general principles in mind:
- Risk a small, fixed fraction per trade. Many educational sources suggest risking no more than 1–2% of account equity on any single position. Because this EA uses a fixed lot size, calculate what that lot represents in monetary risk given your ATR-based stop distance before trading.
- Start on a demo account. Run the strategy in simulation first to understand its trade frequency, drawdown behaviour, and how it reacts to your broker's spreads and execution.
- Understand drawdown. Even a well-designed breakout system will experience losing streaks. Know the maximum historical drawdown of any configuration you test and ask yourself whether you could tolerate it emotionally and financially.
- Account for costs. Spreads, commissions, and slippage all erode results — especially on lower timeframes with frequent trading. Ironically, the very conditions this strategy is designed to avoid (wide spreads) are also the most expensive to trade through.
- Never over-leverage. Leverage magnifies both gains and losses. Size positions so that a normal losing streak does not threaten your account.
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: SpreadRegimeBreakout.ex5 (32 downloads)
- Source Code: SpreadRegimeBreakout.mq5 (29 downloads)
- Documentation: SpreadRegimeBreakout.pdf (36 downloads)