Features

Optimization and validation

Search parameters, validate out of sample, test robustness, and allocate across assets

Search parameters, validate them out of sample, test whether results survive, and allocate across assets. Turn a strategy into a repeatable research workflow, from large parameter sweeps to walk-forward testing, robustness checks, and portfolio optimization.

Start here

What do you want to test?Where to start
Which windows, thresholds, stops, or rules work togetherParameter optimization
How selected settings perform on data they were not chosen onWalk-forward and cross-validation
Whether results depend on a lucky setting, filter, or price historyRobustness and overfitting
How to weight assets and what rebalancing costsPortfolio optimization

features/optimization pages

From a parameter search to a tested strategy

Start with a Python function that calculates signals, runs a backtest, and returns the metrics you want to compare. VBT can run it over a grid or random sample of parameter combinations, then repeat the search across training windows and evaluate the selected settings on the following test periods. You can keep your existing pandas calculations and choose your own scoring rule.

The robustness checks help you investigate what drives the result. Compare nearby settings, remove a filter, delay the signals, or repeat the search on shuffled histories. Results stay labeled by the combinations you tested, so you can inspect drawdowns and trade behavior alongside a headline Sharpe ratio.

From asset weights to a backtest

Portfolio optimization starts with weights. Supply your own weight table, calculate allocations with a function, or use PyPortfolioOpt, Riskfolio-Lib, or Universal Portfolios. VBT turns the targets into a simulation where you can compare rebalancing schedules, weight drift, fees, and performance. An equal-weight basket gives you a simple baseline for the more elaborate methods.

The worked pages show both sides of the process: searching strategy settings and evaluating them out of sample, then comparing asset allocations after trading costs.

Worked tutorials

Follow the Cross-validation tutorial to test strategy robustness, or the Portfolio optimization tutorial to compare allocation methods.

Copyright © 2021–2026 Oleg Polakow. All rights reserved.

Site content and documentation are provided for using and evaluating VectorBT PRO and for educational purposes. Any other use, including building or supporting competing products or services, requires prior written consent.