Skip to content
XauStack

Gold EA curve fitting: MT5 optimization and forward tests

Updated5 min read

Strategy TesterBacktestingOptimization

Curve fitting is the optimizer keeping the parameter set that best matches one stretch of gold’s history, and the Strategy Tester’s Forward option tests for it by retesting the leading sets on data held back.

  • Optimization runs thousands of parameter sets over the same history and keeps the winner. The winner of many is partly skill and partly luck, and its report cannot tell you which.
  • MT5’s Forward option holds back the latest part of your window and retests the leading passes on it. A set that only works before the line was fitted to it.
  • Judging a closed gold EA, ask which window chose its settings, and test it on one that did not.

Search for gold EA curve fitting and page one hands you checklists of numbers to distrust: a profit factor above three, a win rate above eighty-five per cent. Those are symptoms, stated without a source. This guide is about the cause, the optimizer inside the MetaTrader 5 Strategy Tester, and the tool MetaQuotes ships beside it to catch it: the forward period.

What the optimizer is doing

MetaQuotes puts it plainly: “Optimization is testing different values and combinations of input parameters to obtain the best result” (MetaTrader 5 Help). You tick the inputs to vary, give each a start, an end and a step, and the tester runs one pass per combination.

It can try every combination (Slow complete algorithm) or search them with a genetic algorithm, which MetaQuotes calls “much faster than the first one and is almost of the same quality”. The genetic search starts by itself once the combinations exceed 100,000,000 on a 64-bit system, and it needs a criterion to rank passes by: Balance max, Profit Factor max, Recovery Factor max, Sharpe Ratio max, a Complex Criterion max that weighs several, or a custom value the EA computes (MetaTrader 5 Help).

Why the top pass flatters

Every pass runs on the same bars. Give the optimizer four inputs with twenty values each and it tries 160,000 variations of one idea against one stretch of history, then shows you the winner. Part of that winner’s result is the idea working. Part of it is the parameters lining up with the particular swings of that window, which will not come back in the same order.

Gold makes this easy to do by accident. A window in which gold trended hard rewards any set that leans the same way, and the optimizer will find the set that leans hardest. How to backtest a gold EA in MT5 records the same effect in the desk’s own work: rule sets that ranked near the top of the 2026 table produced losing years for several families over 2023 and 2024.

The report of the winning pass looks like any other report. How to read a backtest report explains what each figure means; none of them says how many passes were tried to find it.

The forward period, as MT5 runs it

The Strategy Tester’s Forward field splits your date range in two, with options of 1/2, 1/3, 1/4 or a custom start date, and “The second (latest) part of the total period is always taken for the forward testing” (MetaTrader 5 Help).

The optimization runs on the first part only. Then “10% (in the full search) or 25% (in the genetic algorithm) of best runs are selected and then tested on the forward period”, with a floor: “If the number of best runs is less than 256, the additional best runs are used for forward testing until their number reaches 256” (same page). Back and forward results can be compared on the optimization results and Forward Results tabs, and a vertical line on the optimization graph marks where the forward period starts.

So the forward period is data the optimizer never saw while it chose. That is the whole value of it.

Reading back against forward

Three patterns are worth telling apart:

  • The ranking survives. Passes that led before the line are still near the top after it. The parameters describe something that lasted.
  • The ranking reshuffles. The leading backtest passes are ordinary or losing in the forward period. The top of the list was fitted to the backtest.
  • Everything fails forward. The idea itself may have depended on the first window’s conditions.

Then look at the neighbours. The optimization graph can plot two inputs against each other, with “Variation of the optimization criterion is shown using the color gradient” (same page). A good cell surrounded by good cells is a plateau. A single bright cell among poor ones is a spike, and a spike is what fitting looks like.

One forward window is still one window, and a forward result is still a Strategy Tester result, with every departure a backtest carries.

When you are the buyer, not the optimizer

Most people asking about curve fitting are judging a closed EA whose settings someone else chose. You cannot see the passes they ran, but you can ask three questions:

  1. Which window were the settings chosen on? If the seller cannot say, assume the published run is that window.
  2. Does the published report cover anything after it? A report that ends where the optimization ended has no forward part.
  3. How many inputs were tuned? Every tuned input is another chance to fit.

Then run it yourself over a window outside the published one, as step five of checking a gold EA before you buy says.

The same applies to us. Our Products ship sealed Profiles, so the tuned values are not inputs you can re-optimize, and our published figures cover one window, 1 January to 7 September 2026, in the Strategy Tester. That is a backtest, not a forward test. Each Product’s free Backtest Edition runs inside the Strategy Tester, so you can run any Profile of any of our strategies over a window we did not publish.

Before you act on any of this

Every figure XauStack publishes comes from the MetaTrader 5 Strategy Tester, never from live trading, and no result is promised anywhere on this site. A forward period removes one kind of self-deception; it does not turn a backtest into a forecast. Read the risk disclosure before you act on any report, ours included.

All guides

Book a call