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 Volatility Stability Breakout is a channel-breakout trading strategy for MetaTrader 5 that combines a classic Donchian channel (the highest-high and lowest-low over a lookback window) with an unusual regime filter built on the volatility-of-volatility. In plain terms, most breakout systems only ask whether volatility is high or low. This strategy asks a different question — is volatility steady or erratic? It measures that steadiness using the Average True Range (ATR), a standard gauge of how far price typically moves per bar, and then studies how much that ATR reading itself jumps around over time.
The core idea is that clean, sustained trends historically tend to develop while the market's volatility is calm and orderly — each bar's true range is similar to the one before it, so price can walk in a single direction without violent two-sided whipsaws. When volatility itself is spiking bar-to-bar (news shocks, thin liquidity, stop-runs), breakouts are more often traps that snap back. The strategy quantifies this with the coefficient of variation of the ATR series — the standard deviation of ATR divided by its mean. A low value signals a steady regime; a high value signals a jumpy, untrustworthy one. Trades are only permitted when the reading sits below a configurable threshold.
As a learning tool, this strategy is well suited to intermediate traders who already understand breakouts and ATR-based stops and want to explore how a regime gate can filter signals. It is designed with liquid intraday forex in mind (for example EURUSD on M15 or M30), but it runs on whatever timeframe the chart uses. Treat it as a framework for studying volatility regimes — not as a shortcut to trading success.
How It Works
The strategy evaluates its rules once per completed bar, using the bar that has just closed as the breakout candidate. It computes its own true range and ATR internally from bar data, so it does not depend on any specific ATR indicator handle. Here is what happens on each finished bar:
- Regime gate (the filter): The strategy builds a history of ATR readings and calculates the coefficient of variation over the
VolWindowlookback —StdDev(ATR history) / Mean(ATR history). If this volatility-of-volatility value is belowStabilityThreshold, the regime is considered steady and trading is allowed. If it is at or above the threshold, no new trade is taken. - Breakout trigger: A Donchian channel is built from the
ChannelPeriodbars sitting behind the breakout bar. The strategy signals a potential long when the just-completed bar closes above the channel high, and a potential short when it closes below the channel low. - Expansion confirmation: The breakout bar's own true range must be greater than or equal to the current ATR. This checks that the break is a genuine thrust rather than a marginal poke that barely clears the channel.
- Entry: When the regime is steady, the expansion confirms, and price breaks the channel, the strategy signals a long on an upper break or a short on a lower break — symmetric in both directions.
- Stop-loss: On entry, a stop is placed at
SlAtrMult × ATRaway from the fill price (below for longs, above for shorts). Because it scales with ATR, the stop automatically widens in more volatile conditions and tightens in calmer ones. - Take-profit: A target is placed at
TpAtrMult × ATRfrom entry. With the default settings this creates a reward-to-risk ratio of roughly 3.2-to-1.8, or about 1.78-to-1. - Regime-flip exit: If a position is open and price breaks the channel in the opposite direction, the strategy closes that position — treating the reversal as a regime flip. Only one position per magic number is held at a time.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| ChannelPeriod | 20 | 8 | 60 | Number of bars used to build the Donchian channel that a breakout must clear. |
| AtrPeriod | 14 | 5 | 40 | Length of the ATR, used both for stops/targets and as the base of the volatility-of-volatility series. |
| VolWindow | 20 | 8 | 60 | Lookback window over which the coefficient of variation of ATR is measured. |
| StabilityThreshold | 0.22 | 0.05 | 0.60 | Regime gate — the strategy only trades when the volatility-of-volatility is below this value. |
| SlAtrMult | 1.8 | 0.5 | 5.0 | Stop-loss distance expressed as a multiple of ATR. |
| TpAtrMult | 3.2 | 0.5 | 8.0 | Take-profit distance expressed as a multiple of ATR. |
| Lots | 0.10 | 0.01 | 1.0 | Order volume (position size) in lots. |
A lower StabilityThreshold makes the regime filter stricter, allowing fewer but potentially cleaner setups; a higher value loosens it. A wider ChannelPeriod demands a larger move before a breakout registers. These interactions are exactly what a demo-account study of the strategy can help you understand.

Recommended Chart Settings
This strategy was designed with liquid intraday forex in mind — EURUSD on the M15 or M30 timeframe is a sensible starting point, since major pairs tend to produce the kind of orderly, low-volatility-of-volatility trends the filter is looking for. That said, the code is not locked to any symbol or timeframe; every calculation uses the chart's own primary timeframe, so you can apply it wherever you like for study.
Keep in mind that results will vary significantly across different instruments, sessions, and market conditions. A setting that looks reasonable on one pair may behave very differently on another, and volatility regimes shift over time. Always test any configuration on historical data and a demo account 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
Strengths. The most interesting feature of this approach is its regime awareness. Instead of trading every breakout, it stays flat when volatility is erratic — a period when breakouts historically fail more often. The ATR-scaled stops and targets adapt to the current market's range, and the expansion filter helps screen out weak, marginal breaks. The symmetric long/short logic and the opposite-break exit give it a clear, rules-based structure that is easy to study and reason about.
Known limitations. Breakout strategies in general are prone to false breakouts — price clears the channel, triggers an entry, then reverses. The regime gate reduces but does not eliminate this. Because the strategy waits for both a steady regime and a confirmed expansion, it is selective and may go long stretches without trading, which requires patience. Donchian breakouts also tend to enter after a move is already underway, so part of the initial thrust is missed by design.
Where it may underperform. In choppy, range-bound markets the strategy can still get caught by breakouts that immediately fail, and the regime-flip exit may close trades on the very whipsaws it is trying to avoid. During sudden news-driven volatility spikes, the volatility-of-volatility reading typically rises and locks out new trades — which is the intended behavior, but it also means the strategy may sit on the sidelines during some fast-moving opportunities. No filter is perfect, and steady volatility does not guarantee a sustained trend will follow.
Risk Management Tips
Sound risk management matters more than any single strategy. Consider these general principles as you study this EA:
- Position sizing: Size each trade so that a stop-loss hit costs only a small, predefined fraction of your account. Many educational sources suggest risking no more than 1–2% of your capital per trade.
- Understand your stop distance: Because stops here scale with ATR, the money-at-risk per trade changes with volatility. Calculate what your
Lotssetting actually risks given the current ATR before going live. - Use a demo account first: Test the strategy on a demo account across different market conditions until you understand how it behaves and when it stands aside.
- Respect drawdown: Every strategy experiences losing streaks. Know the maximum drawdown you are willing to tolerate and how it would feel in real terms before committing capital.
- Diversify and stay realistic: Avoid over-concentrating risk on a single instrument or setup, and never trade with money you cannot afford to lose.
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: VolatilityStabilityBreakout.ex5 (42 downloads)
- Source Code: VolatilityStabilityBreakout.mq5 (47 downloads)
- Documentation: VolatilityStabilityBreakout.pdf (41 downloads)