Loading…

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

SettingDefaultWhat it does
Range bars20Bars used for the prior high/low breakout level
Atr fast period7Short ATR period, measures current volatility
Atr slow period50Long ATR period, measures the baseline volatility
Vol expansion ratio1.2Fast ATR must exceed slow ATR by this ratio to allow a trade
Stop atr multiple1.5Stop loss distance from entry, in fast-ATR multiples
Take profit atr mult2.5Take profit distance from entry, in fast-ATR multiples (0 = none)
Use risk sizingfalseSize by percent risk instead of a fixed lot
Risk percent1.0Percent of equity risked per trade, when risk sizing is on
Fixed lots0.10Lot size when risk sizing is off, or as a fallback
Magic number20260709Magic number for orders opened by this EA
Slippage pips3Slippage tolerance, in pips
Max retries5Attempts per trade action before giving up
Retry wait ms500Pause between attempts, milliseconds

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Experts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Breakout · Moving Average · ATR · Channels & Envelopes · Risk & Lot Size · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria