Spokes.wiki Search About
Defined Term concept updated Tue Jun 30 2026 00:00:00 GMT+0000 (Coordinated Universal Time)

Strategy optimization (hyperparameter tuning)

Strategy optimization is tuning a trading strategy’s free parameters — lookback windows, entry/exit thresholds, position-sizing knobs, stop levels — to maximize a backtested objective. It is the search loop wrapped around backtesting: pick parameters → run the backtest → score → repeat. This is the trading-side application of the optimizers catalogued in ../optimization-algorithms-wiki; here the optimizer is a means (the strategy is the subject), so this page bridges to those algorithm pages rather than re-deriving them.

What’s being optimized, and the objective

  • Search space: the strategy’s hyperparameters (a handful to dozens of continuous/discrete knobs).
  • Objective (fitness): a backtested performance metric — total return, Sharpe, drawdown-adjusted return — computed by replaying history. The objective is black-box, noisy, non-differentiable, and multi-modal, which is exactly the regime metaheuristic and model-based global optimizers exist for (metaheuristic-optimization).
  • The cost per evaluation is a whole backtest. That single fact drives the method choice (below) and is why banbot pitches “1 year of klines in seconds” — backtest speed is the budget that caps how much of the parameter space you can search.

The search count is the thing that has to be reported. Every evaluation in this loop is one of the N trials in backtest-overfitting, and N is what determines whether the winning parameters mean anything: with no real edge, seven independent configurations already produce an expected in-sample Sharpe of 1 over two years (pseudo-mathematics-financial-charlatanism). Faster backtests raise N, so the speed this page treats as a pure win also raises the bar the result must clear. No engine in this spoke publishes its N alongside its performance.

The methods banbot ships — mapped to the optimization spoke

banbot‘s built-in tuner offers Bayesian, TPE, random, and CMA-ES search. Each sits on the model-free ↔ model-based axis the optimization spoke draws:

  • cma-es — a model-free evolution strategy: adapts a covariance matrix over a population of parameter sets. Spends many cheap backtests exploring. Good when a backtest is fast.
  • Bayesian / BO and TPE (Tree-structured Parzen Estimator, a sequential model-based / Bayesian variant) — fit a surrogate model of “parameters → score” and use an acquisition function to pick the next trial. Spend few expensive backtests, reasoning about where to look. Their flagship use is exactly hyperparameter tuning (bayesian-optimization).
  • Random search — the no-model baseline both are measured against.

So the choice is the evaluation-budget regime the optimization spoke names: cheap, fast backtests favor population methods like cma-es; slow, expensive backtests favor sample-efficient BO/TPE.

The catch — optimization is where overfitting enters

Maximizing a backtest is the easiest place to fool yourself: enough search will fit parameters to the noise of one history, and the result evaporates live. This is the parameter-search face of the lookahead/over-fit hazard — guarded the same way, by holding out forward-test (out-of-sample) data (algorithmic-trading-wikipedia) and preferring a broad, stable parameter region over a sharply-tuned peak. And because each strategy’s backtest is just one objective, no optimizer dominates across strategies (no-free-lunch-theorem); the right tuner is problem-dependent, balancing exploration-vs-exploitation.

The other answer is to search less. chan-algorithmic-trading argues for “simple and linear strategies, as an antidote to the overfitting and data-snooping biases that often plague complex strategies” — a model with few parameters cannot be tuned to noise as thoroughly, so the discipline is imposed by the model class rather than by the validation protocol. This spoke’s other sources all take the opposite branch: search hard, then guard the search. Recorded as a live disagreement in synthesis, not settled here.

banbot · backtesting · algorithmic-trading · chan-algorithmic-trading · cma-es · bayesian-optimization · metaheuristic-optimization · no-free-lunch-theorem · exploration-vs-exploitation · synthesis