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 together | Parameter optimization |
| How selected settings perform on data they were not chosen on | Walk-forward and cross-validation |
| Whether results depend on a lucky setting, filter, or price history | Robustness and overfitting |
| How to weight assets and what rebalancing costs | Portfolio optimization |
features/optimization pages
Parameter optimization
Sweep millions of parameter combinations with grids, conditions, and random search
Walk-forward and cross-validation
Test optimized parameters out of sample with rolling, expanding, and purged splits
Robustness and overfitting
Check whether a backtest is luck with baselines, permutation tests, and deflated Sharpe
Portfolio optimization
Allocate with your own functions or optimizer libraries and backtest rebalancing
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.