Walk-forward backtesting: the honest way to validate stock strategies

Never test on data your model has seen. StoQuant trains on rolling windows of past data and tests on the next out-of-sample period, including 0.1–0.5% transaction costs and 1–2 cent slippage.

The standard for honest quantitative evaluation

Most backtests are overfitted. They use the same data to train the model and measure performance, creating an illusion of skill. Walk-forward validation prevents this by training on a rolling window of past data (e.g., the last 252 trading days) and testing on the next 21-day out-of-sample window. The model never sees the test data until after it is trained. StoQuant repeats this process daily, storing every prediction and its realized return append-only, so the Proof page can show real walk-forward AUC, hit rate, and quintile spread.

How it works

  1. Establish a rolling training window — Select a time period for training (e.g., 252 trading days of past returns and features). Train the model on this window. Freeze the model; do not look ahead.
  2. Test on the next out-of-sample period — Apply the trained model to the next 21 trading days (or another holdout interval). Measure accuracy against real observed forward returns, including transaction costs and slippage.
  3. Roll the window forward by one day — Discard the oldest training day, add the most recent out-of-sample day to the training set, and repeat. Each day's predictions are stored append-only for permanent audit trail.

Related on StoQuant

Learn the validation framework: Walk-Forward Validation (stoquant.com/learn/walk-forward-validation) and Q-Score Methodology (stoquant.com/learn/q-score-methodology). See current results: Today's Top Q-Score (stoquant.com/today/top-q-score). Compare approach: StoQuant vs Tickeron (stoquant.com/compare/tickeron).

FAQ

What is walk-forward validation?

A backtesting protocol that trains a model on rolling historical windows and tests it on the next out-of-sample period, never using future data during training. It prevents look-ahead bias and overfitting.

Why is walk-forward better than k-fold cross-validation?

K-fold CV shuffles data randomly, violating time-series order. Walk-forward respects causality: the model predicts the future, not the past. For stock returns, time order matters.

How does StoQuant measure walk-forward accuracy?

Every day, we train a new model on the past 252 trading days, generate predictions for the next 30/60/90 days, store them append-only, then match against realized returns. AUC, hit rate, and decile spread are published on /proof.

Does StoQuant include transaction costs in backtest results?

Yes. We deduct 0.1–0.5% per trade and 1–2 cents slippage on small-cap orders. Real-world conditions are baked into the results, not footnoted.