Skip to content

Free MT5 Expert Advisor

Keltner Breakout EA

MT5 Expert Advisor that trades closes outside the Keltner Channel when momentum confirms, with an ATR stop and optional midline exit.

Breakoutv1.0MetaTrader 5 (MQL5) Compiles with 0 errors Stop-loss on every trade
Strategy
Buys when a bar closes above the upper Keltner Channel with momentum above 100 and a bullish candle, and sells on the mirror conditions below the lower channel.
Risk model
1% of balance per trade (configurable), ATR-based stop-loss on every order, one position at a time

What it does

Keltner Breakout EA trades price escaping its normal volatility envelope. The Keltner Channel is built from an EMA and ATR, so it widens and narrows with the market. A close outside it shows an unusually strong bar; the EA asks momentum to agree before it joins the move.

How it works

The channel lines are EMA(20) ± 2 × ATR(10), calculated by the EA from the built-in EMA and ATR. On each new bar:

  • Buy: the last closed bar closed above the upper line, the bar before it closed at or below its upper line, Momentum(10) is above 100.1, and the breakout candle closed above its open.
  • Sell: the last closed bar closed below the lower line, the bar before closed at or above it, Momentum(10) is below 99.9, and the candle closed below its open.
  • Stop-loss: 1.5 × ATR(14) from entry. Take-profit: 2 × the stop distance.
  • Midline exit (optional): a buy is closed when a bar closes below the EMA, a sell when a bar closes above it.

The MT5 Momentum indicator equals the current close divided by the close 10 bars earlier, times 100, so values above 100 mean price is higher than it was 10 bars ago.

How to use it

This is a trend-continuation tool, so it fits markets that move in persistent swings: gold, indices and the more directional currency pairs. H1 and H4 give fewer, cleaner signals than lower timeframes. You can tighten the momentum threshold for stricter confirmation or turn off the candle-direction rule for more trades. Read about moving averages for the EMA basics.

Settings

InputDefaultWhat it changes
Keltner midline EMA period20Channel center
Keltner ATR period / width10 / 2.0Channel width
Momentum period / threshold10 / 100.1Confirmation strength
Breakout candle directiontrueRequires a bullish or bearish candle body
ATR period / Stop-loss (x ATR)14 / 1.5Stop size
Reward:risk target2.0Take-profit, 0 disables it
Midline exittrueEarly exit when the move fails
Risk per trade / Fixed lots1.0% / 0Position sizing
Max spread / Trading hours30 / 7–20Filters
Break-even / Trailingon / offStop management

Limitations

Breakout systems often produce strings of small losses in ranges, with gains concentrated in fewer trending periods. Entries come after a large bar has already closed, so the entry price is sometimes stretched. The midline exit can close a trade during a normal pullback that later resumes.

Before you run it live

Test across several symbols and years in the Strategy Tester, compare results with and without the midline exit, and then run it on demo. Check that the spread filter fits your instrument. Keep risk per trade low, since losing streaks are normal for breakout logic. Past behavior does not guarantee future results.

Key inputs

Key inputs of Keltner Breakout EA
InputDefaultDescription
Keltner midline EMA period20EMA used as the channel center.
Keltner ATR period10ATR used for the channel width.
Keltner width (x ATR)2.0Distance of the channel lines from the EMA.
Momentum period10Lookback for the Momentum indicator.
Buy needs momentum above this, sell below 200 minus this100.1Momentum threshold for confirmation.
Stop-loss distance (x ATR)1.5Stop size as a multiple of ATR(14).
Take-profit as a multiple of the stop (0 = none)2.0Reward-to-risk target.

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