Skip to main content
ForexNews24
Optimising EA Parameters Without Overfitting — Robots & Automation, ForexNews24

Optimising EA Parameters Without Overfitting

An optimiser in a strategy tester will always find the best parameter — that is its job. The question is what that parameter delivers on data it has not seen. We set up the experiment across twelve pairs.

How the experiment was built

Each pair's sample was split in half. On the first half we tested 96 values of an EMA period and selected the best by return. We then ran that same value on the second half, which had taken no part in the selection. There is no trick here: it is exactly what any optimiser in a tester does.

The experiment in numbers

  • 96 values of the EMA period tested on the first half of the sample
  • Median result of the best parameter on its own data — 5.61%
  • The same parameter on the unseen second half — -2.51%
  • Result deteriorated on 8 of 12 pairs and turned negative on 9

The simulation was run over 518 daily bars for each of 12 pairs using the same code as the portal's other calculations. The data is open and the script is in the repository, so the run reproduces.

The gap between selected and real

The median return of the best parameter on its own data was plus 5.6 percent. On unfamiliar data it was minus 2.5. The result deteriorated on eight pairs out of twelve and turned negative on nine. That gap of eight percentage points is the price of selection: it measures not the quality of the strategy but the degree of fitting to a particular stretch.

The detail that explains everything

Look at the median across all 96 parameters rather than only the best. On most pairs it is negative — meaning a typical parameter value produced a loss and only isolated values showed a profit. That is the portrait of randomness: if the rule had a genuine edge, a range of parameters would work rather than a single point. And on one pair even the best of 96 was unprofitable — the optimiser honestly picked the least bad option and still lost.

How to optimise without fooling yourself

Three rules. Look for a plateau rather than a peak: a parameter surrounded by other working values is more reliable than a lone spike. Count the variants tested and demand a larger margin the more there were. And keep part of the data untouched until a single final check — reusing the held-out sample turns it into ordinary training data.

What optimisation cannot give you

It does not create an edge, it only tunes an existing one. If the rule has no edge, the best parameter is the best coincidence and it does not transfer. A practical tell: run the optimisation across several instruments. If the best parameters differ sharply — as in our experiment, where they ranged from 14 to 93 — you are fitting noise.

This material is educational and is not individual investment advice. Backtested results do not guarantee similar results in the future. Trading forex carries the risk of losing capital.

Frequently asked questions

What did the optimisation experiment show?

The best EMA period selected on the first half of the data returned a median of +5.6% there and -2.5% on the second half. The result worsened on 8 pairs out of 12 and turned negative on 9.

How do I tell a real parameter from a fitted one?

By its surroundings. A working parameter sits among other values producing similar results — a plateau. A lone peak among unprofitable neighbours is almost always chance.

Why do different instruments need different parameters?

If optimal parameters diverge sharply between instruments, that indicates fitting to noise rather than tuning to the instrument. In our experiment the best values ranged from 14 to 93.

Digest

New backtest studies — to your inbox

When a new reproducible study comes out or the data is updated, we send a short email. No spam, no "signals", no selling your address.

By leaving your email you agree to receive occasional emails from the portal. Unsubscribe in one click from any of them.

From research to application

In our Allocation product we implemented these algorithms with all the nuances covered across the portal.

Learn about Allocation