DocsComponentsWalk-Forward Analysis

Walk-Forward Analysis

Validate your strategy on data it has never seen

Out-of-SampleRolling & AnchoredWFERobustness ScoreFold Analysis

What is Walk-Forward Analysis?

Standard backtesting lets you optimize parameters on your full historical dataset — but the results are misleading, because the strategy has already "seen" that data. It learns to fit past noise, not real patterns. This is called overfitting.

Walk-Forward Analysis (WFA) solves this by splitting the historical data into multiple sequential windows. For each window, it uses the first portion (in-sample / training) to find the best parameters, then tests those parameters on the next portion (out-of-sample / test) that was held out during optimization.

The out-of-sample results are stitched together into a continuous equity curve — a realistic simulation of how the strategy would have performed if you had been running it live. A strategy that holds up well across all folds has passed a much stricter test than one that merely fits a single historical period.

How It Works

The WFA engine executes a precise sequence of steps for every fold.

01

Fetch & Slice Market Data

Historical OHLCV data is downloaded once for the full requested range. The runner then slices the arrays into per-fold training and test segments without re-fetching.

trainBars, testBars, and stepBars define the window sizes. In anchored mode the training window always starts at bar 0 and grows with each fold.

02

Compute Fold Windows

computeFoldWindows() walks through the data left-to-right, emitting [trainRange, testRange] pairs. Only folds that fit entirely within the dataset are kept.

Rolling mode: fixed train size, steps forward by stepBars. Anchored mode: train always starts at bar 0, grows each fold. stepBars still controls how far forward the test window shifts.

03

Optimize on In-Sample Window

The full parameter sweep runs on the training slice. The combo with the highest value for your chosen selection metric (Net P&L, Profit Factor, Win Rate, Total Return, or Min Drawdown) is selected as the "best params" for that fold.

For maxDrawdown the metric is negated — lower drawdown = better score.

04

Validate on Out-of-Sample Window

The best params from step 3 are run on the held-out test slice in a single-combo backtest. This produces the OOS stats and equity points for that fold.

This is the only result that matters for robustness. A good IS result that degrades badly OOS is a red flag.

05

Compute Per-Fold WFE

Walk-Forward Efficiency (WFE) for the fold = (OOS return / IS return) × 100. A WFE above 50% suggests the strategy generalises well beyond the training period.

Edge cases: if IS return is 0 the WFE is set to 0. Negative IS returns invert the sign, so WFE can be negative.

06

Stitch OOS Equity & Aggregate

The equity points from each test window are concatenated (with bar offsets) into a single stitched equity curve. Aggregate statistics — including the composite Robustness Score — are then computed across all folds.

Robustness Score is a 0–100 composite of WFE, profitable-fold %, OOS Sharpe, IS/OOS correlation, and OOS profit factor.

Rolling vs Anchored Mode

Rolling Mode

Each training window has a fixed size (trainBars). As the test window steps forward, the training window shifts forward by the same amount. Only recent data is used for optimisation.

  • Best for markets that change over time
  • More sensitive to recent regime shifts
  • Produces more folds if data is long
Fold 1: train [0–499] test [500–599]
Fold 2: train [100–599] test [600–699]
Fold 3: train [200–699] test [700–799]

Anchored Mode

The training window always starts at bar 0 and grows with each fold. More and more historical data is included in each optimisation pass.

  • Good for strategies with long-term edge
  • Less prone to random variation in training
  • Later folds are optimised on far more data
Fold 1: train [0–499] test [500–599]
Fold 2: train [0–599] test [600–699]
Fold 3: train [0–699] test [700–799]

Key Metrics at a Glance

Walk-Forward Efficiency (WFE)
Avg OOS return ÷ avg IS return × 100. Target ≥ 50%. Values near 100% indicate the strategy transfers almost perfectly out-of-sample.
Robustness Score (0–100)
Composite score blending WFE, OOS profitable-fold %, OOS Sharpe, IS/OOS correlation, and OOS profit factor. ≥ 65 is Good; ≥ 80 is Excellent.
IS/OOS Correlation
Pearson correlation of per-fold IS vs OOS returns. ≥ 0.5 means strong correspondence. Near 0 or negative signals the strategy does not generalise.

Explore the Documentation

UI Layout

The WFA panel uses a three-column, fully resizable layout.

Left Column (~22%)
  • ↳ Market config
  • ↳ WFA settings
  • ↳ Parameter sweep
  • ↳ Presets
  • ↳ Run / Stop controls
  • ↳ Progress display
Center Column (~58%)
  • Top (~60%)
  • ↳ Fold Table
  • Bottom (~40%)
  • ↳ Tab: Equity Curve
  • ↳ Tab: IS vs OOS Chart
  • ↳ Tab: Fold Gantt
  • ↳ Tab: Param Stability
Right Column (~20%)
  • Top (~40%)
  • ↳ WFA Statistics
  • Bottom (~60%)
  • ↳ Fold Inspector
  •   • IS / OOS tabs
  •   • 8 stat sections

All columns are draggable. The center column also has a top/bottom drag divider between the fold table and the chart area.