Skip to content

Backtest Lab — Sweep

Vary one or two numeric parameters over a grid and read the results as a heatmap. Sweepable params, the 200-run budget, and how to interpret the map.

Sweep takes your base configuration and varies one or two numeric parameters across explicit value lists, running a backtest for every combination and laying the chosen metric out as a heatmap.

Sweepable parameters

Any of these BacktestConfig fields can be a sweep axis (SweepParam):

  • t — strategy lookback
  • topN — number of assets held
  • rebalanceFreq — trading days between rebalances
  • window — ranking window

Pick one axis for a 1-D strip or two axes for a 2-D heatmap. Everything else stays fixed at the base config.

The run budget

Sweeps are capped at 200 combinations (SWEEP_BUDGET = 200). Because a 2-axis grid multiplies (e.g. 10 × 10 = 100 cells, each a full backtest), the Lab counts the combinations before launching and warns you if a grid would exceed the budget — narrow a value list or drop an axis to fit.

Reading the heatmap

  • Each cell is one complete backtest; its color encodes the selected metric (e.g. Sharpe).
  • Look for plateaus, not spikes: a broad region of good values is more trustworthy than a lone bright cell, which is often overfit noise.
  • A failed cell degrades to blank rather than aborting the whole grid.

From heatmap to confidence

A great-looking cell is a hypothesis, not a result. Confirm the winning parameters hold up out-of-sample with Walk-forward before trusting them. See Learn on overfitting.