Backtesting guide

Purged Cross Validation Trading

Purged cross validation trading is a financial machine-learning validation method that removes training observations whose information intervals overlap the validation set. An embargo can add a further buffer around the validation boundary to reduce leakage from nearby observations.

Read the practical guide

Key Takeaways

  • Purging uses information intervals rather than row order alone.
  • An embargo adds separation but does not replace overlap checks.
  • The method is most relevant when labels or features span time intervals.
  • Purged folds reduce leakage but do not correct selection across many models.

Identify overlapping information

For each observation, record when its features become available and when its label or outcome interval ends. A training label that overlaps the validation interval can contain information about validation-period prices even when its row appears earlier. These observations must be identified before creating the folds.

  • Map the start and end time for each label or event.
  • Confirm when every feature would have been observable in real time.
  • Treat concurrent positions and overlapping horizons as possible dependence.

Purge overlaps and apply an embargo

Create each validation fold, then remove training observations whose information intervals intersect it. An embargo excludes an additional region near the validation boundary when nearby observations can still share information. A generic time-series split with a row gap preserves order, but it is not equivalent unless the gap also removes every relevant interval overlap.

  • Perform overlap checks separately for every fold.
  • Choose the embargo from the information horizon rather than an arbitrary percentage.
  • Verify that no training label uses prices inside the validation interval.

Evaluate the folds without reopening them

Fit and select the model using only the permitted training observations. Apply preprocessing within each training fold so scaling, feature selection, and threshold choices do not see validation data. Aggregate fold results with the same metric and retain both the average and the dispersion across folds.

  • Fit transforms and feature selection inside each training fold.
  • Keep the validation fold unavailable until the pipeline is fixed.
  • Use a separate multiple-testing method when many candidates are compared.

Related Pineify workflow

Use time-separated optimization as a preliminary check

Pineify Strategy Optimizer can compare strategy parameters with walk-forward and out-of-sample windows, which helps keep selection and evaluation periods separate.

Strategy Optimizer

Compare parameter choices across separated historical windows.

Open Strategy Optimizer

Boundary: Strategy Optimizer does not inspect label information intervals, purge overlapping training observations, or apply a financial-ML embargo.

This page is educational and does not provide investment advice. Backtests are hypothetical, depend on their data and assumptions, and do not guarantee future results. Trading can result in substantial loss.

Frequently Asked Questions