Skip to content
Wildflower
Join free
Not fooling yourself

Free Trading School · Level 4 · Course 4.3

In-sample and out-of-sample data

Lesson 10 of 18 in Not fooling yourselfModule 3: Testing on fresh data

Testing and making it your own · Not fooling yourself

In-sample and out-of-sample data

Wildflower Trading School · Lesson 4.3.3.1

Wildflower

The last module ended with one answer to overfitting and data mining: fresh data. By the end of this lesson, you'll know how to split your history into a slice you build on and a slice you keep back. You'll know how to read the two results side by side, and the rules that keep the kept-back slice clean. And you'll know exactly what this check can and can't tell you.

1 of 8

What you'll learn

  • Split your data first. Choose a slice to build on and one to keep back before you start.
  • Adjust on the build slice. Change the rules only on this stretch of history.
  • Keep the test slice sealed. Don't look while building, then run it once unchanged.
  • Compare averages per trade. Slices differ in size, so compare per trade.
  • Expect a weaker result. Lucky patterns don't carry over, so check what is left.

Exercise

  1. For your next hand test, write the split into your test plan before you start: which dates you'll build on and which you'll keep back.
  2. Choose a kept-back stretch you haven't scrolled through.
  3. Build only on the first slice, then replay the second once, unchanged, and compare the averages per trade.

Next: Walk-forward testing.

Quick check

  1. 1. Which slice do you build and adjust the rules on?

  2. 2. You see the out-of-sample result, change a rule, and test again on the same slice. What is that slice now?

  3. 3. Why compare averages per trade rather than totals?

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 “Walk-forward testing” is waiting next time.

Read the full notes

Build and adjust a strategy on one slice of history, the in-sample data, and judge the finished rules once on a slice you kept back and never touched, the out-of-sample data.

  • data is the stretch you build and adjust the rules on. data is a stretch kept back and untouched, then used once to the finished rules unchanged. Decide the split before you start.
  • Made-up example: in-sample 80 trades, − 48R = +16R, +0.20R a trade. Out-of-sample 30 trades, 22R − 19R = +3R, +0.10R a trade. Compare averages per trade (expectancy), not totals.
  • A drop on the kept-back slice is what you'd expect if the rules learned some , because noise doesn't carry over. The question is whether something is left, and whether it could easily be chance.
  • Keep it sealed: don't look at the kept-back chart while building ( lets you jump to a date without scrolling), run it once, and if you change the rules afterwards, that slice is in-sample now.
  • It can show how rules did on prices that didn't shape them. It can't say much from a small slice (Sample size), cover markets that slice never had, or say what happens next. More: In-sample and out-of-sample testing.

Worked example

Made-up numbers

Reading the two results

Made-up numbers · one year · wins +2R, losses −1R · split chosen first

  1. In-sample, Jan to Aug: 32 wins, 48 losses. 64R − 48R = 16R ÷ 80 = +0.20R a trade
  2. Out-of-sample, Sep to Dec: 11 wins, 19 losses. 22R − 19R = 3R ÷ 30 = +0.10R a trade

The average halved on the slice the rules hadn't seen. Thirty trades is a , so the second number is honest but uncertain.

Your turn

Drill

Made-up numbers · out-of-sample · 40 trades · 14 wins at +2R · 26 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.