XAUUSD Breakout Retest EA MT5 Free Download
A gold-focused MetaTrader 5 Expert Advisor that waits for H1 EMA trend bias, confirms an M15 breakout, requires a retest of the broken level, then enters only after M5 candle confirmation. It includes risk-percent lot sizing, spread control, daily and peak drawdown guards, and staged stop protection.
What This Gold EA Does
The XAUUSD Breakout Retest EA is designed for traders who do not want a grid or martingale gold robot. The logic is intentionally selective: first it checks trend direction on H1 using EMA20 and EMA50, then waits for an M15 close beyond the prior 20-bar range. After the breakout, the EA does not chase price immediately. It waits for price to retest the broken level inside an ATR-based band, then uses a closed M5 confirmation candle for entry.
Strategy Diagrams

Illustrative buy setup: H1 trend, M15 breakout, retest, M5 confirmation and 3R target structure.

Illustrative sell setup: breakdown, retest of broken support as resistance, then closed M5 bearish confirmation.
Risk Management and Trade Protection
The default preset uses 0.25% equity risk per trade, one symbol/magic position by default, and a maximum of two entries per day. Stops are placed beyond the retest extreme with optional ATR or point buffer. The target defaults to 3R, where R is measured from filled entry to the original stop. The EA never widens an existing stop.
| Price Reaches | Stop Action | Purpose |
|---|---|---|
| +0.8R | Move SL to -0.5R | Reduces worst-case loss after early progress. |
| +1.0R | Move SL to entry plus optional offset | Breakeven stage for capital protection. |
| +1.5R | Move SL to +0.5R | Locks partial R while leaving room for trend continuation. |
| +2.0R | Move SL to +1.0R, then optional M5 swing trailing | Protects gains after a strong move. |
Backtest Snapshot
The included Strategy Tester snapshot is for transparency, not a profit guarantee. The test used XAUUSDm on M5 from January 1, 2026 to September 10, 2026, with 99% history quality and a $1,000 initial deposit.
Backtests can differ from live results because of broker symbol suffixes, spread, execution speed, commission, slippage, server time and gold liquidity conditions. Test on demo first, use your broker's XAUUSD symbol, and reduce risk until behavior is verified.
Default Input Parameters
| Input | Default | Meaning |
|---|---|---|
| InpTradeSymbol | XAUUSD | Symbol to trade. Change if your broker uses XAUUSDm, GOLD, XAUUSD.a or another suffix. |
| InpRiskPercent | 0.25 | Equity risk per trade when risk-percent lot mode is selected. |
| InpMaxEntriesPerDay | 2 | Limits overtrading during noisy gold sessions. |
| InpH1FastEMA / InpH1SlowEMA | 20 / 50 | Defines the higher-timeframe trend filter. |
| InpM15BreakoutBars | 20 | Lookback range used for breakout confirmation. |
| InpRetestATRBand | 0.15 | ATR-based tolerance around the broken level. |
| InpRewardRisk | 3.0 | Default take-profit distance as 3R. |
| InpDailyDDPercent | 3.0 | Stops new trading after the daily drawdown guard is triggered. |
| InpPeakDDPercent | 8.0 | Stops new trading after peak-equity drawdown protection is triggered. |
| InpMaxSpreadPoints | 80 | Blocks entries when spread is above the allowed broker-points threshold. |
| InpDeviationPoints | 30 | Maximum execution deviation in broker points. |
Free Download
Download the compiled MT5 Expert Advisor and the matching preset file. The MQL5 source code is not included in the free download.
How to Install in MT5
- Download `XAUUSD_Breakout_Retest_EA.ex5` and copy it into `MQL5/Experts/`.
- Download `XAUUSD_Breakout_Retest_EA.set` and place it anywhere easy to find.
- Restart MetaTrader 5 or right-click Navigator and choose Refresh.
- Attach the EA to an XAUUSD or broker-suffixed gold chart.
- Load the `.set` preset from the Inputs tab, check the symbol name, then test in Strategy Tester or demo first.
This EA has a trial expiry built into the compiled file. It is intended for testing and education. It is not investment advice and does not guarantee profit.
FAQ
Is this a free XAUUSD MT5 EA?
Yes. The compiled `.ex5` file and matching `.set` preset are available as free downloads.
Is the editable source code included?
No. Only the compiled `.ex5` and `.set` file are public. The editable source file is not published.
Does the EA use grid or martingale?
No. The implementation notes specify no grid, no martingale and no add-on entries.
Which market is it designed for?
It is designed around XAUUSD gold breakout-retest behavior, but symbol input can be changed for broker suffixes or testing other markets.