How to Build a Parameter Sensitivity Heatmap
A practical method for projecting strategy performance across two parameters to distinguish robust edges from overfit point estimates.
A single backtest equity curve is a point estimate. It tells you what would have happened under one specific configuration of parameters across one specific historical slice. The parameter sensitivity heatmap is the antidote: a two-dimensional projection of the performance manifold that reveals whether your strategy lives on a stable plateau or a knife-edge ridge. If your edge collapses when the fast moving average moves from 12 to 13, you do not have an edge — you have a curve fit.
Pick the Two Parameters That Matter
Most strategies have more than two parameters, but heatmaps are constrained to two axes. Choose the parameters with the largest expected interaction effect, not the ones that are easiest to vary. For a trend-following system, that usually means the lookback window and the exit threshold. For mean reversion, the entry z-score and the holding period.
Fix all other parameters at their default values during the sweep. You will repeat this exercise for other parameter pairs later. The goal of any single heatmap is to characterize a slice of the surface, not the whole hypervolume.
Choose a Metric That Penalizes Variance
Raw return is the worst possible color for a heatmap cell. It rewards strategies that got lucky on one tail event and tells you nothing about robustness. Use a metric that incorporates dispersion or drawdown, and use the same metric consistently across all sweeps so heatmaps remain comparable.
A reasonable default is the deflated Sharpe ratio or the Calmar ratio. If you want something simpler that still captures the right idea, use return divided by maximum drawdown over rolling six-month windows, averaged across the sample. The metric matters less than the discipline of using one metric.
Sweep, Store, Render
Define a grid: typically 15 to 25 values per axis, evenly spaced or log-spaced depending on the parameter. A 20-by-20 grid gives you 400 backtests. If a single backtest takes more than a few seconds, you need to parallelize or reduce the grid before you start, not after. In Kestrel Signal, parameter sweeps are batched automatically and results are cached so re-renders with different metrics are instant.
Store the full per-period returns for each cell, not just the summary metric. You will want to recompute the heatmap under different metrics, different sample windows, and different subperiods without re-running the sweep. Disk is cheap; compute is not.
Render with a diverging colormap centered at zero or at the buy-and-hold benchmark for the same asset. Sequential colormaps hide the sign of the result. Annotate the cell containing your live or proposed parameters so you can see at a glance whether you are sitting on a peak or in a valley.
Read the Topography, Not the Peak
The single brightest cell is irrelevant. What matters is the shape of the neighborhood around your operating point. A flat plateau spanning many adjacent cells indicates the strategy is insensitive to small parameter perturbations — the kind of robustness that survives regime change. A sharp peak surrounded by mediocre or negative cells indicates overfitting, regardless of how impressive the peak value is.
Quantify this. For each cell, compute the mean metric across its 3-by-3 neighborhood. Then build a second heatmap from these smoothed values. The smoothed surface is what you should optimize against, not the raw one.
Cross-Validate the Surface
Run the same sweep on a held-out time period — ideally one with different volatility characteristics than your training window. Render both heatmaps side by side. If the high-performing regions correspond between the two surfaces, the strategy generalizes. If they look unrelated, you have learned nothing about the future from your backtest.
A useful summary statistic is the rank correlation between the two heatmaps, treating each cell as an observation. Spearman rho above 0.5 across an out-of-sample period is a meaningful signal of structural edge. Below 0.2, treat the strategy as overfit until proven otherwise. Above 0.8 on financial data is rare enough to warrant suspicion of leakage.
Parameter sensitivity heatmaps will not make a bad strategy good. They will tell you, before you commit capital, whether the strategy you are about to run is robust or whether you have been admiring an artifact of optimization. That is the only question worth answering at this stage.