In-sample data is the part of the history used to choose a rule's settings. Out-of-sample data is a part kept unseen until the rule is fixed, then used once to see how it does. The point is that a rule can always be made to fit the data it was tuned on, so only the unseen part says anything about new data.
Last updated 28 Nov 2026. Reviewed by the Custom Trading Platform education desk. Every figure on this page is sample arithmetic, shown in full.
A history of 1,000 bars is split into 700 and 300. A rule tuned on the first 700 shows a gain of 12 percent. The same rule on the last 300 shows 1 percent. These are sample figures.
The fall from 12 to 1 is what overfitting looks like: the settings captured the quirks of the first part. A rule that shows 12 and then 10 on the unseen part is more convincing, though one test of one split is still thin evidence.
Suppose a test of no real value has a 5 percent chance of looking good by luck. Try 20 settings and the chance that at least one looks good is 1 minus 0.95 to the power of 20, which is 64.2 percent. Try 100 settings and it is 1 minus 0.95 to the power of 100, which is 99.4 percent.
| Settings tried | Chance at least one looks good by luck |
|---|---|
| 1 | 5.0 percent |
| 20 | 64.2 percent |
| 100 | 99.4 percent |
This is why the number of settings tried has to be reported next to the best result, and why the best of many in-sample results is the one least worth believing.
Our own tests keep part of the history unseen, fix the rule before looking, count costs, and say how many rules were tried. Their method is on the methodology page. Where a result held up on the unseen part no better than luck would give, the test pages say so.
An out-of-sample result is still one sample of one period, so it can be lucky too. It also cannot say whether a market will change. For the full routine of a test, see how to backtest a trading strategy.
Every figure on this page is sample arithmetic, shown in full, as of 28 Nov 2026. Each result was worked a second way before it was kept. No market data, price quote, broker term or return is stated as fact. How we check numbers is on the methodology page, and corrections go through contact.
We will recompute every figure in a second spreadsheet and repeat the worked example at a second set of inputs. No result is claimed. Last tested: not yet, results pending.
What is out-of-sample testing? Testing a fixed rule on data that was kept unseen while the rule was chosen.
What is overfitting? Choosing settings that fit the quirks of past data and so do worse on new data.
How much data should I keep unseen? There is no fixed rule. A common split is 70 to 30, decided before looking at any result.
Why does testing many settings give false winners? Each try has a chance of looking good by luck, and the chances add up: 20 tries give about a 64 percent chance of at least one.
Glossary, backtesting, how to backtest a trading strategy, survivorship bias, methodology, Disclaimer.
Start free: create a free account to get the weekly note on tools and tests.
Education only. Nothing here is financial advice or a signal.
© 2026 Custom Trading Platform
Nothing here is financial advice, a signal or an offer. Trading can lose money, and on some products more than you put in. Past results describe the past.