FGE ForexGoldEA
Testing Guide · July 23, 2026

How to backtest a gold EA: data, spreads and honest results

How to backtest a gold EA properly on MT4 and MT5

Every gold robot comes with a beautiful backtest. Almost none of them survive contact with the live market in the same shape. The gap isn't usually dishonesty — it's testing done badly. Here's how to run a backtest that actually tells you something.

Quick answer: To backtest a gold EA properly, use high-quality tick data (99% modelling quality on MT4, or "real ticks" on MT5), set a realistic variable spread rather than a tight fixed one, test over 1–3 years covering different market conditions, and judge it by maximum drawdown — not total profit. Then forward-test on demo, because that's the only real proof.

Why most gold EA backtests are misleading

A backtest replays history against your EA's rules. That sounds objective, but three assumptions quietly inflate the result:

Gold makes all three worse than usual, because XAU/USD is more volatile and more spread-sensitive than a major forex pair. That's why a robot can show a flawless backtest and still lose live — a point we covered in are gold trading EAs actually profitable?

Step 1 — Start with quality data

Garbage data produces confident nonsense. What to aim for:

Rule: if your MT4 report shows modelling quality below 90%, the result isn't worth interpreting for a gold EA — the tester is inventing ticks between M1 bars.

Step 2 — Use a realistic spread

This is the single biggest fixable error. Testing gold at a 10-point fixed spread when your broker averages 20–30 (and 100+ at news) will flatter almost any strategy — and it destroys fast strategies completely.

Set the spread to your broker's realistic average for XAUUSD, or use variable/real spread if your data supports it. Then re-run the test with a spread 50% worse than average. If profitability disappears, the edge was never robust.

Step 3 — Test long enough, across different conditions

One good year proves nothing. Aim for 1–3 years minimum, and make sure the window includes:

Step 4 — Read the right numbers

MetricWhy it matters
Maximum drawdownThe worst losing stretch you'd have to sit through. The most important number by far.
Profit factorGross profit ÷ gross loss. Below ~1.2 is fragile; suspiciously high often means curve fitting.
Number of tradesSmall samples are luck, not evidence.
Equity curve shapeSmooth and gradual beats a curve made by two lucky trades.
Total profitThe least useful number on its own — it's what marketing shows you.

Once you know the drawdown, you can size properly — see how to set risk per trade on a gold EA.

Step 5 — Avoid over-optimisation (curve fitting)

Optimisation finds the settings that would have worked best in the past. Push it far enough and you've fitted history, not the market. Two safeguards:

  1. Out-of-sample testing. Optimise on one period, then test those settings on a separate period you never touched.
  2. Prefer robust settings. If a parameter only works at exactly 14 and collapses at 13 or 15, that's a fluke — pick values that work across a range.
Be especially sceptical of martingale or grid EAs with perfect backtests — their risk hides in the rare sequence that history didn't contain. See what is a martingale grid EA.

Step 6 — Forward test on demo (the only real proof)

After the backtest, run the EA on a demo account for several weeks in current conditions. This is where real spreads, slippage, execution and news behaviour show up — none of which a tester can fully model. If demo results roughly match the backtest's character (not its exact profit), you have something worth a small live account.

Need to get the EA installed first? See how to install a gold EA on MT4 & MT5 or the MT5 setup guide.

MT4 vs MT5 for backtesting

Both work, but MT5's tester is meaningfully better for gold: it supports real tick data natively, runs multi-threaded (much faster), and handles multi-symbol testing. MT4 can reach 99% quality but needs imported tick data and more setup. If you have the choice, backtest on MT5.

Frequently asked questions

How do I backtest a gold EA on MT4 or MT5?

Open the Strategy Tester, pick the EA and XAUUSD, set the date range, use every-tick (real ticks on MT5) modelling and a realistic spread, then run it and review the report — starting with maximum drawdown.

What modelling quality should it have?

90% minimum on MT4, 99% with imported real tick data. On MT5 use "every tick based on real ticks". Below 90% on MT4 isn't trustworthy for gold.

Why do backtests look better than live results?

They assume tight fixed spreads and perfect fills, and settings are often over-fitted to past data. Gold's spread widening around news makes the gap worse.

How long should I backtest?

At least 1–3 years, covering trending, ranging and high-volatility periods, with enough trades to be meaningful.

What metrics actually matter?

Maximum drawdown first, then profit factor, trade count and equity-curve shape. Total profit alone is the least informative.

What is curve fitting?

Tuning settings until they fit history perfectly. Guard against it with out-of-sample testing and robust parameter ranges.

Is a backtest enough before going live?

No. Always forward-test on demo for several weeks first, then start small.

Bottom line

A backtest is a hypothesis, not proof. Done properly — good tick data, honest spreads, a long and varied period, drawdown-first analysis, and no curve fitting — it tells you whether a gold EA is worth forward-testing. Done badly, it's a marketing image. The discipline is simple: make the test harsher than reality, and let the demo account have the final word.

Trading gold on margin carries a high level of risk and may not be suitable for everyone. Backtested results are not indicative of future results. This article is educational and not financial advice.
Get ForexGoldEA free & test it on demo → Talk to us on Telegram →

Affiliate disclosure: we earn a commission when you open and fund an account through our partner links, at no extra cost to you.