walk-forward-validation

Generate walk-forward train/test splits with purging and embargo buffers.

1|Updated May 15, 2026
One-click install
npx skills add https://github.com/dnkrow/skill --skill walk-forward-validation-dnkrow
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: walk-forward-validation
Source: https://github.com/dnkrow/skill/tree/main/claude-global/walk-forward-validation
Command: npx skills add https://github.com/dnkrow/skill --skill walk-forward-validation-dnkrow

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires numpy, pandas, scipy, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Walk-forward validation prevents misleading backtest results caused by lookahead bias, overlapping labels, and serial correlation when evaluating trading strategies and time-series ML models.

Core Features & Use Cases

  • Time-series aware splitting (rolling/expanding windows): Generates realistic train/test folds that move forward in time to mirror how a model would be deployed.
  • Leakage controls (purging + embargo): Removes training samples with overlapping label horizons and applies a buffer gap to reduce correlated leakage across the split boundary.
  • Overfit detection for strategy research (CPCV + DSR/PBO): Uses combinatorial purged cross-validation to produce many test paths, then quantifies multiple-testing-driven overfitting via Deflated Sharpe Ratio and Probability of Backtest Overfitting.
  • Crypto and regime considerations: Offers practical window sizing guidance and regime-aware validation thinking tailored to 24/7 markets.

Quick Start

Run walk-forward validation on your strategy’s historical returns using a rolling or expanding window with a purge horizon and an embargo window to obtain out-of-sample Sharpe and drawdown per fold.

Frequently Asked Questions about walk-forward-validation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent time-series leakage in trading backtests?

Prevent time-series leakage in trading backtests by applying walk-forward validation with purging and embargo buffers. This removes overlapping training labels and enforces a gap across split boundaries to eliminate serial correlation and lookahead bias.

What is combinatorial purged cross-validation for overfitting detection?

Combinatorial purged cross-validation generates multiple test paths to quantify multiple-testing-driven overfitting. It calculates Deflated Sharpe Ratio and Probability of Backtest Overfitting metrics to evaluate if a strategy is robust or overly fitted to historical data.

How do I run walk-forward validation with purging and embargo on historical returns?

Run walk-forward validation on historical returns by configuring rolling or expanding windows with a specified purge horizon and embargo window. This yields out-of-sample Sharpe ratios and drawdowns per fold for leakage-safe evaluation.

Can I use numpy and pandas for regime-aware time-series splitting?

Yes, you can use numpy and pandas for regime-aware time-series splitting. The skill leverages these dependencies to generate deterministic, time-ordered folds with configurable parameters tailored for continuous 24/7 crypto markets.

What is the best way to validate financial ML models without lookahead bias?

The best way to validate financial ML models without lookahead bias is using purged time-series splits with embargo buffers. This approach ensures training data never contains future information that overlaps with test sets.

When should I not use standard k-fold cross-validation for trading strategies?

Standard k-fold cross-validation fails for trading strategies when serial correlation and overlapping labels exist. Without purging and embargo buffers, random folding causes lookahead bias and misleadingly optimistic backtest performance metrics.