Skip to content
Wildflower
Join free
Not fooling yourself

Free Trading School · Level 4 · Course 4.3

What overfitting is

Lesson 6 of 18 in Not fooling yourselfModule 2: Overfitting

Testing and making it your own · Not fooling yourself

What overfitting is

Wildflower Trading School · Lesson 4.3.2.1

Wildflower

This module is about a trap that catches careful testers in particular: overfitting. By the end of this lesson, you'll know what it is, and why a rule that fits the past perfectly can do badly on new prices. You'll see how it creeps into a strategy one sensible-looking rule at a time, and the signs that a strategy might be overfitted.

1 of 8

What you'll learn

  • Spot overfitting. A strategy tuned too tightly learns the random wobble in past prices.
  • Compare old and new data. A perfect fit on the past can miss new prices the most.
  • Question each new rule. Extra rules can end up describing which past trades lost.
  • Know the warning signs. Look out for rules with no reason, few trades and fussy settings.
  • Write a reason for each rule. Do it before you see any test result.

Exercise

  1. Take a strategy sheet you've written, or one from The strategy library.
  2. Next to each rule, write one sentence on why it should matter in the market, before any result.
  3. Mark any rule whose only reason is "it made the test better".

Next: Too many rules, too few trades.

Quick check

  1. 1. A rule that fits every past wiggle perfectly is most likely to…

  2. 2. Which is a warning sign of overfitting?

  3. 3. Why can't you spot overfitting from the built-on data alone?

0 of 3 answered.

Finished this lesson?

Tick it off and keep your place

Make a free account and we'll remember where you are, so “Too many rules, too few trades” is waiting next time.

Read the full notes

Overfitting is tuning a strategy so tightly to past prices that it learns their random wobble. It looks excellent on the data it was built on and does worse on new prices.

  • is tuning a strategy so closely to past prices that it describes their random wobble, the , as well as anything that might repeat. It fits the past and does badly on new prices.
  • Made-up dots: a straight line misses the old dots by about 0.5 on average and the new ones by about 0.3. A wiggly line through every dot misses the old ones by 0 and the new ones by 2.6. Perfect on the past, worst on the future.
  • Made-up rules (wins , losses −1R): rule 1 gives +3R from 12 trades; "skip Tuesdays" lifts it to +6R; "skip if the last was red" to +8R from 7 trades. On new prices: 6 trades, 0R.
  • Signs: rules with no reason you could explain, very few trades left, exact settings that matter a lot, and a big drop on prices the strategy hasn't seen.
  • More: Overfitting a trading strategy.

Worked example

Made-up numbers

Rules that fitted the wobble

Made-up numbers · wins +2R, losses −1R

  1. Rule 1 alone: 12 trades, 5 wins, 7 losses. 10R − 7R = +3R
  2. Add "skip Tuesdays": 3 losses gone. 10R − 4R = +6R
  3. Add "skip if the last candle was red": 2 more gone. 10R − 2R = +8R from 7 trades
  4. New prices: 6 trades, 2 wins, 4 losses. 4R − 4R = 0R

Every rule improved the past, but they described which trades happened to lose, not the market.

Your turn

Drill

Made-up numbers · new prices · 8 trades · 3 wins at +2R · 5 losses at −1R

Trading is risky. You can lose money. Test results are hypothetical, and a good test doesn't mean future profits. This lesson explains how testing works. It isn't advice.