Free MT5 Expert Advisor · Version 1.00

A transparent trend assistant with conservative default risk

TF Donchian ATR Assistant evaluates completed H4 candles, trades a 55-bar breakout only in the EMA 200 direction and sizes each position from its ATR stop. It is supplied as one individual download—not a bundle.

Includes .mq5 source, .ex5 binary, individual README and SHA-256 checksums.

Illustration of a Donchian channel breakout with an ATR risk shield
Exact rule set

How a trade is selected

  1. The EA runs once when a new H4 signal bar has completed; it does not use an unfinished candle as a signal.
  2. A long setup requires the completed close to break above the highest high of the preceding 55 completed bars and to be above EMA 200. A short setup mirrors those conditions.
  3. The spread, trade window, daily-loss lock and one-position-per-symbol rules must all pass.
  4. The initial stop distance is the greater of 2.2 ATR and the broker’s minimum stop distance. The default target is 2.5 times that initial distance.
  5. Volume is calculated against the estimated stop loss in account currency and rounded down to the symbol’s permitted volume step.
Capital protection

Risk controls built into the code

Control Default Purpose
RiskPercent 0.50% Balance-based risk estimate; any input above 1.00% is rejected.
StopATR 2.20 Adapts the initial stop distance to recent volatility.
RewardRisk 2.50 Defines the initial target as a multiple of initial risk.
DailyEquityLossLimit 2.00% Stops new entries after the day reference has fallen by the threshold.
MaximumSpreadPips 2.00 Avoids new entries when the quoted spread is unusually wide.
Position guard One per symbol Stands aside if any EA or manual position already exists on the symbol.

The EA contains no grid, martingale, recovery sizing or averaging down. These controls reduce specific risks; they cannot cap losses during gaps, slippage, disconnections or execution failures.

Why this family

Evidence, stated precisely

Price breakouts belong to the broader trend/time-series momentum family. Moskowitz, Ooi and Pedersen documented time-series momentum across almost five dozen futures and forward contracts, including currencies. Their study supports examining transparent trend rules; it does not validate this exact Donchian/EMA/ATR configuration or future retail-FX results.

Read the research paper

Where it struggles

Known failure modes

Sideways markets can create repeated false breakouts. A 200 EMA is a lagging filter. ATR measures recent ranges but cannot predict gaps or news liquidity. Several currency pairs may carry the same USD or risk-on exposure, so a 0.50% setting on each chart is not a 0.50% portfolio risk.

Before live use

Installation and validation

  1. Extract this EA’s ZIP. Copy the .ex5—or the .mq5 and .ex5—to MQL5/Experts in the MetaTrader 5 data folder.
  2. Refresh Navigator, attach the EA to the intended chart and check broker server time, spread convention, volume step and stops level.
  3. Run symbol-specific tests with variable spread, commission and slippage. Separate development, later out-of-sample and demo-forward periods.
  4. Review maximum drawdown, consecutive losses, trade count and sensitivity to modest input changes. Do not select a setup only because it maximizes historical profit.
  5. Start disabled or on demo, verify journal messages and keep aggregate exposure within a written risk plan.
Technical integrity

Auditable and reproducible

Both MQL5 source and the compiled MT5 file are supplied. Version 1.00 compiled with 0 errors and 0 warnings. ZIP SHA-256: 8774e9dafa8cb44a9bc014a09f03def1be26207f52f0b7aca8d53640ddb5ee56.

Position sizing uses MetaTrader’s account-currency profit estimate rather than assuming a fixed pip value. See the official OrderCalcProfit documentation.

Broker option

Open an account with HFM

If HFM suits your jurisdiction and requirements, you can use our sponsored link. Compare regulation, costs and account terms independently before registering.

Open an account with HFM

Affiliate disclosure: Trade-Forex.info may receive compensation if you register through the HFM link, at no additional charge to you. Leveraged trading is high risk. This software and page are educational information, not personal investment advice.