Volatility Breakout EA
The breakout level is the literal prior InpRangeBars-bar high or low - a plain Donchian channel, not a volatility-scaled band around a moving average. That distinguishes this from an ATR channel EA, where the entry level itself widens and narrows with volatility; here the level is fixed by price alone, and volatility is used only as a gate on whether to act on it. The gate compares a short ATR (InpAtrFastPeriod) against a longer ATR (InpAtrSlowPeriod): a breakout is only taken when the fast reading is at least InpVolExpansionRatio times the slow one. Range breakout systems are most prone to false signals precisely when the market has been quiet - price grinds sideways, eventually pokes past the range on noise, and promptly reverts. Requiring volatility to already be expanding before the breakout is trusted is a direct filter against that specific failure mode, at the cost of missing breakouts that happen to fire before volatility itself has picked up. Stop and target are both set in fast-ATR multiples from entry rather than fixed pips, so both scale with how volatile the symbol is at the exact moment of entry. Position sizing can run as a fixed lot or, with InpUseRiskSizing on, as a percentage of equity risked to that ATR-scaled stop distance, computed from MODE_TICKVALUE and MODE_TICKSIZE rather than a hardcoded contract size. Notes and limitations - The expansion filter reduces false breakouts but cannot eliminate them; a genuine volatility spike can still fail to follow through. - A qualifying breakout that fires while volatility has not yet expanded is skipped entirely - there is no queued re-check once the ratio later clears, so a legitimate but early move can be missed. - Exit is entirely the ATR stop and take profit set on the order; there is no separate time-based or trailing exit. - Signals are evaluated once per closed bar, not on every tick. - One position at a time, tracked by InpMagicNumber. It will not manage or interfere with trades opened manually or by another EA. - Requires AutoTrading enabled and IsTradeAllowed() true; if trading is disabled the EA logs it and skips the entry.
Expert advisor · MT5 · v1.0 · Free
About Volatility Breakout EA
Volatility Breakout EA is an expert advisor (trading robot) for MetaTrader 5 based on ATR. It can size trades from your balance and risk percent and trades breakouts. It has 13 settings, such as Range bars, Atr fast period and Atr slow period. MQL source code included.
Files in the download: VolatilityBreakoutEa.ex5, VolatilityBreakoutEa.mq5, VolatilityBreakoutEa.txt.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Range bars | 20 | Bars used for the prior high/low breakout level |
| Atr fast period | 7 | Short ATR period, measures current volatility |
| Atr slow period | 50 | Long ATR period, measures the baseline volatility |
| Vol expansion ratio | 1.2 | Fast ATR must exceed slow ATR by this ratio to allow a trade |
| Stop atr multiple | 1.5 | Stop loss distance from entry, in fast-ATR multiples |
| Take profit atr mult | 2.5 | Take profit distance from entry, in fast-ATR multiples (0 = none) |
| Use risk sizing | false | Size by percent risk instead of a fixed lot |
| Risk percent | 1.0 | Percent of equity risked per trade, when risk sizing is on |
| Fixed lots | 0.10 | Lot size when risk sizing is off, or as a fallback |
| Magic number | 20260709 | Magic number for orders opened by this EA |
| Slippage pips | 3 | Slippage tolerance, in pips |
| Max retries | 5 | Attempts per trade action before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Experts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Breakout · Moving Average · ATR · Channels & Envelopes · Risk & Lot Size · MT5 Expert Advisor · MQL5 Source Code