An indicator only plots a line or fires an alert — an Expert Advisor (EA) actually sends orders on your behalf. This free EA trades the breakout strategy covered in the Donchian Channels lesson directly: the moment price closes beyond the highest high or lowest low of the prior N bars, it 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 — the same entry logic that anchored the original Turtle Trading system, rebuilt as a self-contained EA.
How the Strategy Works
The entry signal is the same one covered in the Donchian Channels indicator lesson: has the just-closed bar's Close finished above the highest High of the prior DonchianPeriod bars, or below the lowest Low of the same window? Because the band is built only from bars before the one being tested, a breakout here always means price has moved into territory the recent lookback window genuinely hadn't covered — not merely that the current bar happens to be part of its own new extreme. A close above the upper band is read as a bullish breakout and triggers a BUY; a close below the lower band is the mirrored bearish case and triggers a SELL.
There's no built-in Donchian function in either MetaTrader 4 or MetaTrader 5, so this EA calculates the highest high and lowest low directly from the High/Low price series on every new bar, using the same prior-N-bar window described in the indicator lesson.
Stop Loss, Take Profit, and Position Sizing
Stop Loss and Take Profit are sized from ATR rather than from the Donchian band itself — Stop Loss distance is ATRMultiplier × ATR (default multiplier 2.0, ATR calculated over ATRPeriod, default 14), 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: RiskPercent (default 1.0%) of account balance is divided by the Stop Loss distance to produce a lot size, keeping the dollar amount at risk roughly constant even as the ATR-based stop distance changes with volatility. See Lot Sizes Explained for how this lot size is then normalized to the broker's minimum, maximum, and step lot size before the order is sent. UseFixedLot is available as an escape hatch for a constant lot size regardless of account risk.
Entry Conditions
- BUY — the just-closed bar's Close is above the highest High of the
DonchianPeriodbars before it. - SELL — the just-closed bar's Close is below the lowest Low of the
DonchianPeriodbars before it.
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 20260726), 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
- DonchianPeriod (default 20) — the lookback window the highest-high/lowest-low entry band is built from. A shorter period triggers more, smaller breakouts; a longer period (55, the second Turtle system) requires a larger move before entering.
The remaining parameters aren't specific to this strategy: they belong to the risk engine shared across the whole EA collection, explained in one place on the EA hub. This EA identifies its own trades with magic number 20260726.
Why This EA Uses ATR for the Stop, Not the Opposite Donchian Band
The original Turtle system used a second, shorter Donchian channel for exits — a 10-day low to exit a long, for example — rather than a fixed-distance stop. That approach is workable, but it couples the exit distance to whatever the shorter channel happens to measure at that moment, which can be very wide right after a strong breakout and very narrow during a quiet one, making risk per trade inconsistent from one signal to the next. This EA instead follows the same ATR-based Stop Loss pattern used across every other EA on this site: the stop distance is a direct multiple of current volatility, and position size is calculated backward from that distance to keep the dollar risk on every trade roughly constant. The trade-off is that this EA's stop doesn't structurally reference the channel itself the way the original Turtle exit channel did — it's a deliberate simplification that keeps the risk model consistent with the rest of this site's EAs rather than reproducing every detail of the historical Turtle system.
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 close beyond the Donchian band confirms only that price has reached a new N-bar extreme, not that a sustained move follows, and false breakouts that reverse immediately are common enough that a string of losses during choppy conditions should be expected. Consider combining this EA with a trend-strength filter such as ADX rather than trading every Donchian breakout in every market condition. The MT4 and MT5 downloads are readable source — study them completely and understand every input before this EA runs on a live account. None of the above is personal financial advice — it is a technical explanation, nothing more.