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
- 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.
- Choose a kept-back stretch you haven't scrolled through.
- Build only on the first slice, then replay the second once, unchanged, and compare the averages per trade.
Quick check
1. Which slice do you build and adjust the rules on?
2. You see the out-of-sample result, change a rule, and test again on the same slice. What is that slice now?
3. Why compare averages per trade rather than totals?
0 of 3 answered.
Finished this lesson?
Tick it off and keep your place
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.
- The part of the price history used to build and adjust a strategy’s rules. The part kept back to test them is out-of-sample.More in the glossary data is the stretch you build and adjust the rules on. History kept back while a strategy’s rules are built, then used once to test the finished rules unchanged. The part used to build them is in-sample.More in the glossary data is a stretch kept back and untouched, then used once to Running a strategy’s exact rules over past prices to see which trades they would have taken.More in the glossary the finished rules unchanged. Decide the split before you start.
- Made-up example: in-sample 80 trades, A result measured in units of the amount at risk. If a trade risks 4 points, 1R is 4 points and a 6-point gain is +1.5R.More in the glossary − 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 The small, random ups and downs in price that don’t follow any pattern that repeats. A rule tuned to noise fits the past but not new prices.More in the glossary, 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 (A chart feature that hides the candles after a point you choose, then shows them again one at a time, so you can practise on past prices without seeing ahead.More in the glossary 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 numbersReading the two results
Made-up numbers · one year · wins +2R, losses −1R · split chosen first
- In-sample, Jan to Aug: 32 wins, 48 losses. 64R − 48R = 16R ÷ 80 = +0.20R a trade
- 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 How many trades a test is based on. A small sample can look very different from a larger one just by chance.More in the glossary, so the second number is honest but uncertain.
Your turn
DrillMade-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.