Our partnerSkilling
  • Spreads from 0.1 pips
  • 1,000+ instruments
  • Free demo account

65% of retail investor accounts lose money when trading CFDs with this provider.

SkillingOpen account
Module 3 · Build and test strategies with AI

3.4 Overfitting: the biggest trap

Lesson 13 of 26Reading time: 2 minFact-checked

Overfitting means that the strategy is fitted to the historical data so closely that it captures random noise instead of real patterns.

Overfitting: perfect in testing – poor in realityData the strategy was built onNew dataOverfitted: 25 rules, perfect historySimple: 3 rules, robustIllustration. The more rules and parameters, the easier it is to “find” patterns that are just chance.
The strategy with the most rules looks best in the test – and falls apart on new data.

Why AI makes the problem bigger

With AI you can test thousands of combinations of indicators and settings in seconds. Test enough variants and some will look fantastic – purely by chance. This is called data snooping.

The coin-toss strategy

Imagine 1,000 people each toss a coin ten times. Around one of them gets ten heads in a row. Does that person have a talent for tossing coins? No – there were simply many attempts. The same thing happens when you test a thousand strategies and pick the best one.

How to expose overfitting

  • Few rules and few settings. Every extra parameter increases the danger.
  • Logic first. Can you explain why the strategy should work?
  • Robustness: Change the settings slightly. If the result collapses, the strategy is fragile.
  • Out-of-sample test: Test on data you have not seen.
  • Walk-forward: Optimise on one period, test on the next, move forward and repeat.
  • Count your attempts. If you have tested 200 variants, the result has to be much better to be credible.

Ask the AI to play devil’s advocate

“Here is my backtest result. What signs of overfitting do you see, and how can I test whether the result is real?”

Key takeaways

  • Overfitting means the strategy has learned random noise, not real patterns.
  • With AI you can test thousands of variants – some will look good by chance.
  • Use few rules, test robustness and test on data you have not seen.
Practise what you have learned – without riskTry it on a free demo account with Skilling, with real prices and virtual money.
Open a free demo account

65% of retail investor accounts lose money when trading CFDs with this provider.