Out-of-sample testing is a way to guard against curve-fitting. Its a good practice because we don’t know how the market will go in the future. When we ultimately trade our strategy it will be on live data as it evolves, not on the historical price data used for backtesting.
Here’s how out-of-sample testing works: First a backtest is performed on a given test period. Then the same backtest is run on a new test period — a different sample of data, hence the name. If the parameters or settings were over-optimized in the first backtest, its unlikely that they will perform well in the second time period.
For example, its possible to tweak the parameters on just the right indicators to make over 1000% gains in backtesting. But when we run those same settings in another period, it might actually lose money. If it is custom fit to one set of data, it won’t work as well in a different set of data. Much better to find that out with an additional backtesting run rather than live trading!
With two different time periods, the results are almost always going to be at least a little different.
The most challenging situation is if the original sample is a bull market and the out-of-sample is a bearish period (or vice versa).
My backtesting reports are broken into distinctly different samples for exactly this reason.
To be completely effective, the out-of-sample data should only be used once. Each backtest should have its own out-of-sample data because if it is used frequently, the out-of-sample data too easily becomes in-sample data. Using Monte Carlo method is better in this respect. See Evidence-Based Technical Analysis: Applying the Scientific Method and Statistical Inference to Trading Signalsfor more information.
(Backtesting Blog is an Amazon Associate.)