How to backtest a Gold EA in MT5: a reproducible XAUUSD test

25 September 2026, 11:11
Jarrod Emery
0
19

A useful backtest should be repeatable. Before comparing a profit figure, record the inputs that produced it. This practical workflow is for anyone evaluating an XAUUSD Expert Advisor in MetaTrader 5.

Disclosure: I develop ExpertCodeFX trading tools, including ECFX XAU Redline. The checks below apply to other EAs too. They are a testing workflow, not a recommendation to trade Gold or a promise of returns.

1. Freeze the test configuration

Record the EA name and exact version, MT5 build, broker/server, symbol, timeframe, dates, starting deposit, account currency and leverage. Save the input preset before running. If you change a setting, save a separate preset and report so the two tests remain distinguishable.

A simple test record can look like this:

EA/version: ______
Preset filename: ______
Broker/server and symbol: ______
Timeframe and date range: ______
Deposit/currency/leverage: ______
Tick model and execution delay: ______
Costs and data limitations: ______
Report and journal filenames: ______

2. Check the broker's actual Gold symbol

In Market Watch, open the symbol specification. Gold may have a suffix or a different name on your broker. Confirm contract size, tick size, minimum volume, volume step, trading sessions and relevant stop restrictions. Do not assume that a lot size or price-distance setting has the same effect across different brokers or instruments.

Use the EA's current manual for its intended symbol and timeframe. If no trades appear, first inspect the Tester journal for missing history, invalid volume, insufficient margin or other errors. Randomly changing inputs until trades appear makes comparison harder.

3. Choose and record the tick model

Open Strategy Tester, select the EA and exact broker symbol, and set your date range and inputs. Where suitable data is available, use Every tick based on real ticks for the detailed run. MetaTrader also offers generated-tick modes; these are different data assumptions, not interchangeable evidence.

Check the completed report and journal for data-quality limitations. A tick-model label by itself does not establish that every historical interval had complete broker data. See MetaQuotes' explanation of real and generated ticks:
MetaQuotes: real and generated ticks

4. Document trading costs and execution assumptions

Record how spread, commission, swap and execution delay are represented in your test. A profitable result under favourable costs may not survive less favourable execution. Run a separate sensitivity test where your setup supports it, preserving the original baseline for comparison.

A historical simulation cannot reproduce every live condition. Keep that limitation alongside the result rather than assuming a rising curve proves future performance.

5. Read the risk and the trades

Review equity drawdown, balance drawdown, trade count, losing streaks and the distribution of results across time. Examine whether a small number of trades dominate the outcome. An open losing position can affect equity before the loss appears in the closed-trade balance.

Use visual mode to inspect a sample of entries and exits. If an outcome looks unexpected, check the order history and journal before drawing a conclusion from the chart.

6. Keep an untouched test period

Choose a separate period before tuning. Run the same saved settings on that period without adapting them to its outcome. If you repeatedly change the settings after viewing it, it is no longer an untouched check.

MT5's forward-testing feature splits historical data into optimization and subsequent test periods. This is distinct from observing new trades on a running demo account. MetaQuotes documents the tester controls here:
MetaQuotes: Strategy Tester guide

7. Save the evidence and observe demo execution

Save the completed report, preset and relevant journal logs together. Then, with a version licensed for that use, observe execution on a broker demo account and compare behaviour with the test assumptions. Demo and live fills can still differ.

For MQL5 Market products, the downloadable demo is for the Strategy Tester; it is not a free licence to run the purchased EA on a normal demo chart. Check the product's current terms and supported setup.

Redline walkthrough and checklist

Our ECFX XAU Redline walkthrough demonstrates the download-and-backtest process. The accompanying ExpertCodeFX page includes the video, checklist and documentation links:
Watch the Redline walkthrough and read the checklist

Official MQL5 product page:
ECFX XAU Redline on MQL5

Which part of your first MT5 test is most confusing: selecting the broker symbol, loading a preset or interpreting drawdown? Leave a specific setup question below, without account credentials or private account information.

Automated trading carries substantial risk. Backtests and demo results do not guarantee future performance. This article is educational and does not provide personalised investment advice.