i Short answer

Overfitting is tuning a strategy so closely to past data that it captures noise rather than a real edge. It looks excellent in a backtest and fails on new data. The more versions you test, the more likely the best one is just lucky: if 1,000 rule variations with no edge each trade 100 times, the best will typically show about +0.39R per trade by chance alone. Simple rules, few parameters, out-of-sample tests and checks for stability across settings are the defences.

The expectancy calculator shows a strategy’s average result, the number overfitting inflates.

1. What is overfitting?

Every price history contains patterns that will not repeat. A strategy with many rules and finely tuned settings can be bent to fit those patterns, producing a backtest that looks like a discovery but is really a description of the past. The fewer trades and the more settings, the bigger the risk. How backtests are run is covered in backtesting.

2. How does luck create great-looking backtests? A worked example

Assumptions (hypothetical example): 1,000 variations of a strategy, none with a real edge (true expectancy 0R); each tested on 100 trades; individual trade results vary with a standard deviation of 1.2R; the best variation is chosen.

The best of 1,000 strategies with no edge
StepWorkingResult
Standard error of each backtest’s expectancy1.2R ÷ √1000.12R
Typical best of 1,000 random resultsAbout 3.24 standard errorsAbout +0.39R
Expected live result of that best variationTrue expectancy0R

A simulation of the same set-up gives the same answer: picking the best of many variations produces an impressive average purely from luck. Testing 3 settings with 10 values each is already 1,000 combinations. The more you search, the higher the bar for believing a result.

1,000variations tested
0.12Rstandard error per backtest
+0.39Rbest result from luck alone
0Rwhat it earns live
At a glance: What Is Overfitting and How Do I Avoid It in Backtesting?
At a glance: What Is Overfitting and How Do I Avoid It in Backtesting?

⬇ Download this summary (PNG) · Free to share with the credit “Source: TradeAnswers” (CC BY 4.0).

3. What are the signs of an overfitted strategy?

Warning signs
  • Many rules or settings relative to the number of trades
  • Results that collapse when a setting changes slightly
  • Excellent results in one period and poor ones in another
  • Rules added to remove specific losing trades
  • Live or out-of-sample results far below the backtest

Sensitivity to small setting changes is what a degradation test measures.

4. How do you avoid overfitting?

Keep rules simple and few. Decide settings from reasoning before testing, not after. Hold back a period of data the strategy never sees during development and test on it once at the end. Roll the test forward through time, as described in walk-forward testing. Prefer settings where nearby values also work, so the result does not hinge on one exact number. Count how many variations you tried, and expect the best to fall back.

5. How do you know a live strategy was overfitted?

Compare live results with the backtest after enough trades. A large, persistent gap is the classic sign, though it can also mean the market has changed, as covered in edge decay. The expectancy calculator, which also gives the profit factor gives a second measure to compare. Tests of rules also apply to discretionary methods, as discussed in discretionary versus systematic trading (CME Group, technical analysis course).

6. Does automated optimisation make overfitting worse?

Often. Software can test millions of combinations in minutes, which makes finding a lucky one almost certain. Strategy marketplaces and bots frequently advertise optimised backtests for this reason, as covered in trading bots and expert advisors.

In-sample against out-of-sample, and why many tests mislead

Worked example (hypothetical): a moving average strategy is tuned on 2018 to 2022 data, the in-sample period, and the best settings return +0.30R a trade. Run unchanged on 2023 to 2025, the out-of-sample period, the same settings return +0.02R. The drop is the sign of overfitting: the settings described past noise, not a lasting pattern.

Testing many variations makes this worse. If a strategy has no edge and you test 20 independent versions, the chance that at least one looks significant at the 5% level by luck alone is 1 − 0.95²⁰, about 64%. Count how many versions you tried, keep the out-of-sample period untouched until the end, and be more sceptical the more settings you searched.

★ Why It Matters

Search enough past data and you will always find a strategy that looked brilliant. The question is not how good the best backtest is, but how many you tried to find it and whether it holds on data it never saw.

✕ Common mistakes

  • Adding rules to remove past losing trades. That fits noise.
  • Testing thousands of settings and keeping the best. Luck alone gave +0.39R in the example.
  • Skipping out-of-sample tests. Keep unseen data for a final check.
  • Trusting results that depend on one exact setting. Nearby values should also work.

Key Takeaways

  1. Limit parameters to three or fewer.
  2. Hold back recent data for testing.
  3. Check that small parameter changes keep results stable.
  4. Prefer simple rules that work across instruments.
Share this answer:LinkedInXEmail

Frequently asked follow-up questions

What is overfitting in trading?

Tuning a strategy so closely to past data that it captures noise and fails on new data.

How do I know if my strategy is overfitted?

Check for many settings, sensitivity to small changes, and poor results on unseen data.

How many parameters is too many?

There is no fixed number, but fewer is safer, especially with a small number of trades.

Does more data prevent overfitting?

It helps, but testing too many variations can still produce a lucky winner.

What is out-of-sample testing?

Testing on data that was not used to build or tune the strategy.