Skip to content

Free MT5 Expert Advisor

ATR Volatility Breakout EA

MT5 Expert Advisor that trades a close beyond the previous close plus or minus k × ATR, with an ATR stop and an optional time exit.

Volatilityv1.0MetaTrader 5 (MQL5) Compiles with 0 errors Stop-loss on every trade
Strategy
Buys when a bar closes more than k × ATR above the previous close and sells when it closes more than k × ATR below it. Trades exit at the stop, the target or after a set number of bars.
Risk model
1% of balance per trade (configurable), ATR-based stop-loss on every order, one position at a time

What it does

ATR Volatility Breakout EA looks for a bar that moves much more than usual. It measures the distance from the previous close in units of ATR, so the same setting adapts to quiet and busy markets. When a close jumps beyond that threshold, the EA joins the move.

How it works

On every new bar the EA uses two closed bars: the signal bar (the last closed bar) and the reference bar (the one before it).

  • Levels: reference close ± 1.0 × ATR(14) of the reference bar. Using the ATR known at the reference bar means the level was fixed before the signal bar started.
  • Buy: the signal bar closes above the upper level.
  • Sell: the signal bar closes below the lower level.
  • Stop-loss: 1.5 × the current ATR from entry. Take-profit: 2 × the stop distance.
  • Time exit: with the option on, any trade still open after 20 bars is closed at market, whatever its profit or loss.

The idea comes from classic volatility-breakout systems: a range expansion often marks the start of a directional move, and a time stop limits how long capital stays in a trade that goes nowhere. See the lesson on volatility for background on ATR.

How to use it

H4 and D1 suit this logic best because one-bar expansions on low timeframes are often just noise or news spikes. Raising the breakout multiple to 1.5 gives fewer but larger signals. You can turn off the take-profit and rely on the time exit plus a trailing stop if you prefer to let strong moves run. Check the sizing of a 1.5 × ATR stop with the Pip Calculator.

Settings

InputDefaultWhat it changes
ATR period14Volatility measure
Breakout multiple (k)1.0Size of move needed
Stop-loss (x ATR)1.5Stop size
Reward:risk target2.0Take-profit, 0 disables it
Time exit / barstrue / 20Maximum holding period
Risk per trade / Fixed lots1.0% / 0Position sizing
Max spread (points)30Spread filter
Trading start / end hour7 / 20Server-time window
Break-even / Trailingon / offStop management

Limitations

Large bars often happen on news, and the next bar can retrace part of the move, so entries at the close of a big bar are exposed to pullbacks. Signals are infrequent on higher timeframes. The time exit can close a trade just before it would have reached its target. Weekend gaps on D1 can make the signal bar's move look larger than it was during trading hours.

Before you run it live

Run it in the Strategy Tester over several years and symbols, compare different breakout multiples, and then on a demo account. On D1 set the trading hours to cover the time of the daily bar change. Keep the risk per trade small. Past behavior does not guarantee future results.

Key inputs

Key inputs of ATR Volatility Breakout EA
InputDefaultDescription
ATR period14Bars used for the Average True Range.
Breakout distance from the previous close (x ATR)1.0How large the move must be to count as a breakout.
Stop-loss distance (x ATR)1.5Stop size as a multiple of ATR.
Take-profit as a multiple of the stop (0 = none)2.0Reward-to-risk target.
Close the trade after a number of barstrueTurns the time exit on or off.
Bars before the time exit20Maximum holding time in bars.

Educational tools, not advice. Automated trading can lose money quickly. Indicators and Expert Advisors describe price; they do not predict it, and past behaviour does not guarantee future results. Test everything on a demo account first and never risk money you cannot afford to lose. See our disclaimer.

Keep exploring

Related mt5 expert advisors