Skip to content

Parameter Sweep

A parameter sweep runs your strategy across a grid of parameter combinations and displays the results as a heatmap. It answers the question: "Does this strategy work because I found a genuinely good idea, or because I found a lucky parameter setting?"

How it works

  1. In the Strategy panel, click Parameter Sweep (available after selecting an indicator).
  2. Define a range for each tunable parameter — minimum, maximum, and step size.
  3. Click Run Sweep. MarketHeist evaluates every combination and displays a 2D heatmap (or 1D line chart for single-parameter indicators).

The heatmap color represents the Sharpe ratio of each parameter combination tested on the same full data series.

INFO

All parameter combinations in a sweep are tested on the same in-sample data. A sweep tells you whether robust parameters exist, but it does not validate out-of-sample performance. Use Walk-Forward Optimization for OOS validation.

Reading the heatmap

Look for a plateau, not a spike

The goal is to find a wide, flat region of good performance — a plateau where many adjacent parameter combinations all produce similar, above-average Sharpe ratios.

Good sign — wide plateau:

Parameter B
  ^
50|  ░░▒▒▓▓▓▓▒▒░░
40|  ░▒▒▓▓▓▓▓▒▒░░
30|  ░░▒▒▓▓▓▒▒░░░
   ───────────────>  Parameter A
      10  20  30

Many nearby combinations perform similarly. A small change in parameters doesn't break the strategy.

Bad sign — isolated spike:

Parameter B
  ^
50|  ░░░░░░░░░░░░
40|  ░░░░▓░░░░░░░
30|  ░░░░░░░░░░░░
   ───────────────>  Parameter A
      10  20  30

Only one combination performs well. This almost certainly reflects overfitting to historical noise. The strategy is unlikely to hold up on new data.

Why spikes are dangerous

When you find a peak by exhaustive search, you are selecting the one parameter combination that happened to match the noise in the historical data. This is sometimes called data snooping bias or multiple comparisons problem. The more combinations you test, the higher the probability that the best-looking result is spurious.

A realistic analogy: if you test 100 random coin-flip strategies, you'd expect 5 to show Sharpe > 1.5 just by chance. The heatmap helps you see whether you found signal or just got lucky.

Practical guidelines

Choose parameters from the center of a plateau

If you do find a plateau, pick parameters near the center — not the absolute best point. Parameters at the center are furthest from the edges of the plateau, meaning they have the most "room" before performance degrades.

Narrow plateaus should still be treated with suspicion

Even a plateau that spans 3–4 parameter steps may be an artifact of the backtest period. Always follow up with walk-forward validation.

Watch for regime dependency

A parameter that works well on 2010–2024 data may fail on 2000–2010 data. If the tool shows you the full date range, try sweeping over a sub-period to see if the plateau is stable across market regimes.

When no good region exists

If the entire heatmap is grey (low Sharpe across all parameters), the indicator is not a good fit for this ticker or time period. This is a valid and useful result — it saves you from trading a losing strategy. Move on to a different indicator or consider whether the underlying hypothesis is sound.

Overfitting prevention summary

PracticeWhy it helps
Look for plateaus, not peaksPeaks are likely noise; plateaus are likely signal
Pick center-of-plateau parametersMaximizes distance from degradation edges
Limit the number of combinations testedFewer tests = lower false discovery rate
Follow up with walk-forwardPlateaus can still fail out-of-sample
Test across multiple sub-periodsConfirms plateau is not regime-specific

Next steps

MarketHeist Backtest Engine