Subscribe
EN

Guide · 3 min read

How to backtest a gold strategy in the MT5 Strategy Tester

Short answer: Open the Strategy Tester (Ctrl+R), pick your EA, XAUUSD and a long date range, and choose "Every tick based on real ticks". Set a random delay, check that spreads and commission in the report match your real account, and keep the last part of the data out of any optimization with the Forward option. Then judge the result on enough trades, after costs.

Published: 24 October 2026.

Free, no sign-up On sale: the Monthly Pass and the Lifetime Pass. See the plans

The tester will produce a smooth curve for almost anything if you let it. These steps make it harder for the test to flatter you.

Step by step

  1. Open the tester
  2. Choose the EA and symbol
  3. Dates
  4. Modelling
  5. Delays
  6. Deposit and leverage
  7. Forward
The steps in order, each one explained below.
  1. Open the tester: View → Strategy Tester, or Ctrl+R.
  2. Choose the EA and symbol: XAUUSD, on the time frame the EA trades.
  3. Dates: a long range with quiet, trending and crisis years in it.
  4. Modelling: "Every tick based on real ticks" if the broker's history covers your dates. It replays recorded prices and spreads.
  5. Delays: a random delay rather than "Zero latency, ideal execution", so fills are not perfect.
  6. Deposit and leverage: the same as the account you would really use. Read gold margin and leverage for why it matters.
  7. Forward: set a share, such as a third, so the last part of the range is kept out of optimization and tested afterwards.

Check the costs in the report

Open the trades list in the report and look at a few of them:

Our checklist of what a real gold EA backtest should include goes further.

Read the result honestly

Why tests fail live

Most failures come from tuning to the past, leaving out costs, or luck. Our guide on why gold EAs pass the backtest and fail live explains each one and how to test against it.

The same idea in a Baroq agent

The Lab in a Baroq AI agent works the same way: it tries variations of your idea on past candles, picks on one part and shows the other part on its own, with a luck test for how many variations were tried. Then you can switch the agent ON and watch it on demo money.

The Monthly Pass and the Lifetime Pass are software licences for your own MetaTrader account. They score every robot and strategy you run the same way, with costs inside every number. See the plans.

FAQ

Which modelling mode should I use for gold in MT5?

Every tick based on real ticks, when your broker's tick history covers your dates. It replays the recorded prices and spreads. 1 minute OHLC and Open prices only are faster but can hide what happened inside a bar.

Does the MT5 tester include the spread?

With real ticks it uses the spreads stored in the broker's tick history. Check the report's trades against a few real quotes, because gaps in the history can make spreads look better than they were.

Does the tester charge commission?

Only if the broker has set it up for the symbol in the tester. Check the report: if every trade shows zero commission and your real account pays one, the test is too kind. Add the cost before you judge the result.

What is the Forward option in the tester?

It keeps the last part of your date range out of the optimization, then runs the chosen settings on it. It is a simple way to see results on prices the settings were not tuned on.

How many years of gold data should a backtest cover?

Enough to include very different markets: quiet years, trending years and crisis spells. Several years and a few hundred trades or more is a sensible floor. Fewer trades can look good by luck.

Why do my live results differ from the backtest?

Usually because the test was tuned to the past, left out real costs, or had too few trades. Our guide on why gold EAs fail live goes through each cause.

Gold EA Checking Kit, $9

Every check from these articles, on one printable page.

An educational tool. It is not investment advice. Trading leveraged products such as gold CFDs carries a high risk of losing money, and you can lose all of it.

BaroqTech makes software. It is not investment advice and it does not manage money. Trading leveraged products such as gold CFDs carries a high risk of losing money, and you can lose all of it. Results from a test or from a demo account do not predict results on a real account.

Free book · PDF · 6 pages

How to Read a Backtest Without Fooling Yourself

How to read any backtest, ours included: unseen prices, costs, the luck test, curve fitting and the five tricks that make a bad idea look good.

We send the download link to this address and keep the address for this book. Without the tick, that is the only email. The book itself is in English. Privacy: what we store and why.

Keep reading

All 73 guides

Markets in numbers

Compared

Seasonality

Volatility

Price history

Best time to trade

Moving averages

Market correlations

RSI

Limited time offer

20% off

your first month of the Monthly Pass

Offer ends 31 October 2026

We email you the code and one note when the trading system goes on sale. Unsubscribe in any email. Privacy