An indicator only plots a line or fires an alert — an Expert Advisor (EA) actually sends orders on your behalf, which means every design choice inside it carries real money consequences. This free EA trades a breakout strategy built directly on Keltner Channels: it waits for price to close beyond the EMA-and-ATR band that defines "normal" recent movement, then opens a trade in the direction of that breakout, with Stop Loss, Take Profit, and position size all calculated automatically from ATR and account risk.
How the Strategy Works
The entry signal is the same one covered in the Keltner Channels indicator lesson: has the just-closed bar's Close finished above the upper band (EMA + ATR × multiplier), or below the lower band (EMA − ATR × multiplier)? A close above the upper band means price has moved further from its recent EMA than its own recent bar-to-bar volatility would typically produce — read as a bullish breakout. A close below the lower band is the mirrored bearish case. Unlike a reversal strategy that fades a band touch expecting price to snap back, this EA trades in the direction of the break, on the premise that a move large enough to clear an ATR-scaled band is more likely to be the start of a genuine push than routine noise.
Because the EMA and ATR that define the band are recalculated on every bar, the channel itself widens and narrows with current volatility — the exact same distance in pips means something different in a quiet market than a volatile one, and the band adjusts for that automatically before the EA ever checks whether price has broken it.
Stop Loss, Take Profit, and Position Sizing
Stop Loss and Take Profit are sized from ATR rather than a fixed pip distance, using the same ATRPeriod/ATRMultiplier pattern used throughout this site's EAs — note this is a separate ATR reading (ATRPeriod, default 14) from the one used to size the Keltner Channel band itself (ChannelATRPeriod, default 10), so the entry trigger and the risk sizing can be tuned independently. Stop Loss distance is ATRMultiplier × ATR (default multiplier 2.0), and Take Profit is then set at RiskRewardRatio × Stop Loss distance (default 2.0), giving every trade this EA opens the same fixed reward-to-risk shape regardless of pair or timeframe.
Position size follows the exact worked-example method from Risk Management Basics and Lot Sizes Explained: RiskPercent (default 1.0%) of account balance is divided by the Stop Loss distance to produce a lot size, so the dollar amount at risk stays roughly constant even as the ATR-based stop distance changes with volatility. The calculated lot is normalized to the broker's minimum, maximum, and step lot size before the order is sent, and UseFixedLot remains available for anyone preferring a constant lot size independent of the risk calculation.
Entry Conditions
- BUY — the just-closed bar's Close is above the upper Keltner Channel band (EMA + ChannelATRMultiplier × ChannelATR).
- SELL — the just-closed bar's Close is below the lower Keltner Channel band (EMA − ChannelATRMultiplier × ChannelATR).
Three safety mechanics govern every trade this EA can place, matching the standard used across every EA on this site: it evaluates entry conditions once per new bar only, tracked via the bar's open time, so a single qualifying bar can't trigger repeated entries within the same candle; it opens only one position at a time, checked by counting open trades filtered to this EA's own symbol and magic number before any new entry is considered; and it checks the current spread against MaxSpreadPoints (default 30) before sending an order, skipping the entry if the spread is too wide to trade at a reasonable price. Every order is tagged with MagicNumber (default 20260723), so the EA's position-counting logic never touches a trade opened manually or placed by a different EA running on the same account.
Parameters
- EMAPeriod (default 20) — the period of the Keltner Channel's center EMA line.
- ChannelATRPeriod (default 10) — the ATR lookback used to size the Keltner Channel's band width.
- ChannelATRMultiplier (default 2.0) — how many ATR-widths the entry band sits from the center EMA. Narrower values trigger more, smaller breakouts; wider values require a larger move before entering.
All other inputs configure the common risk engine described on the EAs overview — how stops and targets are sized, how the lot is calculated from RiskPercent, and which safety checks gate every order. Its orders are tagged with magic number 20260723.
Why Two Separate ATR Readings Exist
It would be simpler to use one ATR calculation for both the Keltner Channel's band width and the Stop Loss distance, and early in development that's a reasonable starting point — but it couples two decisions that don't actually need to move together. The Keltner Channel's band width determines how far price has to travel before the EA considers a move a genuine breakout at all; the Stop Loss's ATR multiplier determines how much room a trade is given to breathe once it's opened. A trader who wants a tighter entry filter (a narrower ChannelATRMultiplier, catching breakouts earlier) doesn't necessarily want a tighter Stop Loss too — in fact a wider ATRMultiplier on the Stop Loss side is often the right pairing with an earlier, more sensitive entry, since an earlier entry means price has less room to prove the breakout is real before the Stop Loss would otherwise be tested. Keeping ChannelATRPeriod/ChannelATRMultiplier and ATRPeriod/ATRMultiplier as fully separate inputs lets a trader tune "how easily does this EA decide a breakout happened" independently from "how much room does a trade get once it's opened" — two genuinely different questions that happen to both be answered with an ATR multiple.
A Word of Caution
Test on a demo account first, across different market conditions and multiple pairs, before risking real money — a good backtest or demo run never guarantees future results. This EA can and will lose on individual trades: a breakout beyond the Keltner Channel confirms only that price has moved further than recent ATR-scaled volatility would typically predict, not that the move continues, and a sharp reversal immediately after entry will still get stopped out at a loss. Consider combining this EA with a trend or momentum filter (a higher-timeframe check, ADX, or Trend vs Range structure) rather than trading Keltner breakouts in every market condition, since a channel break during a genuinely range-bound market is more likely to revert than one during an established trend. Both platform versions below ship as source code; read them in full, and be sure each parameter's role is clear to you before going live with it. All of this is educational material; none of it is advice about what you personally should trade.