Optimisation without overfitting

TRADINGPROFITTEVOLE · FREE GUIDE 02/05

Optimisation without overfitting

Optimisation means searching for sensible settings. The danger is discovering parameters that were perfect only for the past.

Why optimise an Expert Advisor?

Many strategies have adjustable trading hours, entry thresholds, stop losses, take profits and volatility filters. Trying different combinations can reveal how a system behaves. But each additional trial also increases the chance of discovering an exceptional historical result by coincidence. That is why I never choose a parameter set solely because it appears at the top of a profit ranking.

Overfitting: when the past becomes a trap

An overfitted strategy depends on peculiarities of the historical sample that may never repeat. Its backtest can look exceptionally smooth, then deteriorate when markets change. Warning signs include overly precise settings, very few trades, drastic differences between neighbouring inputs and profits concentrated in one period. These are reasons to investigate—not proof by themselves.

Separate research from verification

One straightforward method is to use one part of the data for selecting parameters (in-sample) and a separate, previously untouched period for checking them (out-of-sample). When possible, I repeat the test across different periods and another broker’s price history. Even an out-of-sample win can be luck; I look for consistent behaviour, not infallibility.

A stable region beats a perfect point

If nearby parameter values produce reasonably similar outcomes, the strategy looks less dependent on one exact number. I call this a zone of robustness. If changing a threshold from 20 to 21 turns large gains into substantial losses, the fragility deserves attention. Before adding filters, I also ask whether the trading idea is understandable.

A simple example

Suppose a take profit of 370 points yields the best historical gain, but values of 350 and 390 produce much worse results. The apparently “magic” setting may just be a historical coincidence. A whole range of similarly behaving values would be more encouraging evidence. These numbers are purely illustrative.

Checklist before moving on

  • Were the parameter-selection and verification periods kept separate?
  • Do small input changes leave the outcome broadly understandable?
  • Does the result rest on enough trades?
  • Are spread and commission assumptions credible?
  • Can I explain the market rationale of every filter?

I prefer an intelligible, reasonably robust strategy to a spectacular backtest that works only with millimetre-perfect settings. The next step is to consider the risk I would need to bear.

This guide is for educational purposes only. Trading involves the risk of losing capital. Historical data and simulations do not guarantee future results.

← Back to all free guides