backtest
Generate complete VectorBT backtesting scripts with data fetch, signals, stats, and plots.
- Supports 10+ pre-built strategies (EMA crossover, RSI, Donchian, Supertrend, MACD, SDA2, momentum, and more) with template-based script generation
- Fetches data from OpenAlgo API or loads directly from DuckDB; auto-detects Historify vs custom formats
- Uses TA-Lib for standard indicators and OpenAlgo ta for specialty indicators (Supertrend, Donchian, Ichimoku); includes signal deduplication via
exrem() - Generates portfolio stats, strategy vs NIFTY benchmark comparison table, QuantStats HTML tearsheet, Plotly equity/drawdown charts, and CSV trade exports
- Handles Indian delivery fees (0.111% + ₹20 fixed) and F&O lot-size constraints (NIFTY 65, BANKNIFTY 30)
Create a complete VectorBT backtest script for the user.
Arguments
Parse $ARGUMENTS as: strategy symbol exchange interval
$0= strategy name (e.g., ema-crossover, rsi, donchian, supertrend, macd, sda2, momentum)$1= symbol (e.g., SBIN, RELIANCE, NIFTY). Default: SBIN$2= exchange (e.g., NSE, NFO). Default: NSE$3= interval (e.g., D, 1h, 5m). Default: D
If no arguments, ask the user which strategy they want.
Instructions
More from marketcalls/vectorbt-backtesting-skills
vectorbt-expert
VectorBT backtesting expert. Use when user asks to backtest strategies, create entry/exit signals, analyze portfolio performance, optimize parameters, fetch historical data, use VectorBT/vectorbt, compare strategies, position sizing, equity curves, drawdown charts, or trade analysis. Also triggers for openalgo.ta helpers (exrem, crossover, crossunder, flip, donchian, supertrend).
1.2Koptimize
Optimize strategy parameters using VectorBT. Tests parameter combinations and generates heatmaps.
924strategy-compare
Compare multiple strategies or directions (long vs short vs both) on the same symbol. Generates side-by-side stats table.
886quick-stats
Quickly fetch data and print key backtest stats for a symbol with a default EMA crossover strategy. No file creation needed - runs inline in a notebook cell or prints to console.
841setup
Set up the Python backtesting environment. Detects OS, creates virtual environment, installs dependencies (openalgo, ta-lib, vectorbt, plotly), and creates the backtesting folder structure.
800