In-Sample vs Out-of-Sample
Build on one slice of history, test on a slice you never saw. The discipline that catches self-deception.
The single most important discipline in backtestingTesting a trading strategy on historical data. is splitting your history into two parts: *in-sampleThe data a model was built and fitted on. data (which you use to build and tune the strategy) and out-of-sample data (which you set aside and test on only after* the strategy is finalised, never having seen it).
- In-sampleThe data a model was built and fitted on. — the data you build, tune and optimise the strategy on; results here are expected to look good.
- Out-of-sample — held-back data the strategy never saw; the only honest test of whether the edgeA repeatable, structural reason your trades win over time. is real.
- The iron rule — test out-of-sample once, at the end; repeated peeking-and-tweaking contaminates it into in-sampleThe data a model was built and fitted on..
What if my strategy fails out-of-sample — can I just adjust it?
If you re-tune based on out-of-sample results, that data is now *in-sample* (you’ve fitted to it), and you no longer have an honest test. The disciplined response is to go back to the drawing board with a *new* hypothesis and reserve a *fresh* untouched slice — or use walk-forward analysis (later module), which formalises repeated honest testing. Don’t quietly fit to your “test” set.