Every Quant

Out-of-sample testing

Short answer

Out-of-sample testing means judging a trading strategy on data that was not used to design or tune it. It is the main check that a strategy reflects a lasting market behaviour rather than a fit to past noise.

Data used to build a strategy is called in-sample. Any result on that data is flattered, because the designer chose the rules partly by looking at it. Out-of-sample data is held back, and the strategy meets it only after the design is fixed. How far results fall from the design data to the held-back data is among the most useful pieces of evidence a tester can collect.

How it is used in strategy design and testing

The simplest method is a hold-out split: develop the idea on an earlier part of the history and test it once on a later part. A stronger method is walk-forward testing, where the tester repeatedly fits on a window of the past, tests on the period that follows, then moves forward and repeats. This mimics how the strategy would have been used in real time.

Out-of-sample data can also mean other markets or other assets. If an idea is said to rest on a general behaviour, it should appear in related markets it was never tuned on. Some practitioners treat a period of small-scale trading with real money as the final out-of-sample test, because it adds real costs and real fills.

Common mistakes

  • Peeking. Looking at out-of-sample results and then changing the rules turns that data into in-sample data.
  • A test period that is too short. A short period may contain only a single kind of market and say little.
  • Same regime in both periods. If both periods share the same conditions, the test checks less than it seems.
  • Selecting among many out-of-sample winners. Choosing the strongest of many strategies on out-of-sample data reintroduces selection bias.

Where the term comes from

Welch and Goyal showed that many published predictors of the equity market looked useful in sample but did poorly out of sample, a widely cited example of why hold-out tests matter.

Education only. Not investment advice.

Questions people ask

What does out-of-sample mean in trading?

It means data the strategy was not built or tuned on. Testing on it shows whether the idea holds beyond the history used to create it.

What is walk-forward testing?

Walk-forward testing fits a strategy on a past window, tests it on the period that follows, then rolls both windows forward and repeats. The joined test periods form a longer out-of-sample record.

How much data should be held out?

There is no single rule. The test period should be long enough to include different market conditions, and it should be fixed before the tester looks at any results.

Can out-of-sample results still be misleading?

Yes. If the tester has run many out-of-sample tests and kept the strongest, or adjusted the design after seeing them, the results carry the same selection bias as in-sample work.

Papers

Written and checked by the Every Quant research team · Updated . How we write and check entries: methods.