Choosing the Embargo Length
An embargo is a gap left between training and test data in a walk-forward backtest so that overlapping information — like a feature built from a rolling window — can't leak from one side to the other.
Financial features are rarely built from a single day of data — a 20-day momentum signal, a rolling volatility estimate, or a label that looks 5 days ahead all span a window of time, not a point. If a training sample's window overlaps with a test sample's window, information from the test period has effectively leaked into training, and the backtest's accuracy will look better than it will ever be live. An embargo is a buffer of time, inserted immediately after the training set and before the test set, during which no data is used at all, long enough that no feature or label window straddles the boundary.
Choosing the embargo length means matching it to the longest lookback or lookahead used anywhere in the pipeline: if the slowest feature uses 60 days of history and the label looks 5 days forward, the embargo should span at least 65 days, otherwise some test-set rows still share raw data with training-set rows.
The embargo must be at least as long as the longest window used to build any feature or label — anything shorter leaves a leakage channel between train and test.
A model with a 10-day label and a 30-day rolling feature needs an embargo of at least 30 days (the longer of the two), not 10 — sizing it to the shorter window would still let stale training information bleed into the first weeks of the test set.
Related concepts
Practice in interviews
Further reading
- de Prado, Advances in Financial Machine Learning (ch. 7)