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).
Detected risks:
A VectorBT backtesting expert for designing and running quantitative trading backtests in Python. It activates when the user wants to backtest strategies, create entry and exit signals, analyze portfolio performance, optimize parameters, fetch historical data, compare strategies, work with position sizing, equity curves, drawdown charts, or trade analysis, and it also triggers on openalgo.ta helpers such as exrem, crossover, crossunder, flip, donchian, and supertrend. The working environment is Python with vectorbt, pandas, numpy, and plotly, drawing data from OpenAlgo for Indian markets, DuckDB for direct database access, yfinance for US and global data, and CCXT for crypto.
The skill enforces a set of critical rules. Technical indicators are always computed with TA-Lib, never with VectorBT built-ins, while specialty indicators not in TA-Lib (Supertrend, Donchian, Ichimoku, HMA, KAMA, ALMA, ZLEMA, VWMA) and signal utilities (exrem, crossover, crossunder, flip) come from openalgo.ta, with an inline exrem fallback when openalgo.ta is unavailable. Raw signals are always cleaned with ta.exrem() after a fillna(False), fees are auto-selected per market (Indian STT and statutory charges plus a fixed per-order amount, or US and crypto equivalents), every backtest produces a Strategy versus Benchmark comparison table, and reports are explained in plain language. Plotly candlestick charts use a category x-axis to avoid weekend gaps and the plotly_dark template, equities use whole-share sizing, and API keys load from a single root .env via find_dotenv rather than being hardcoded.
Depth is organized into modular rule files under rules/ covering data fetching, simulation modes, position sizing, indicators and signals, stop-loss and take-profit, parameter optimization, performance analysis, plotting, market-specific cost models, futures, long-short trading, DuckDB and CSV loading and resampling, walk-forward analysis, robustness testing, pitfalls, a strategy catalog, and QuantStats tearsheets. Production-ready strategy templates live in rules/assets, including EMA crossover, RSI, Donchian, Supertrend, MACD, SDA2, momentum and dual momentum, buy and hold, RSI accumulation, walk-forward, and realistic-cost comparisons, and a standard backtest script template is provided inline. Scripts are placed in backtesting/{strategy_name}/ directories created on demand, and no icons or emojis are used in code or logger output.
TA-Lib is always used for indicators such as EMA, SMA, RSI, MACD, BBANDS, ATR, ADX, STDDEV, and MOM. VectorBT built-in indicators like vbt.MA.run() or vbt.RSI.run() are never used.
From openalgo.ta, which provides Supertrend, Donchian, Ichimoku, HMA, KAMA, ALMA, ZLEMA, and VWMA, plus signal utilities like exrem, crossover, crossunder, and flip. There is an inline exrem fallback when openalgo.ta is not importable.
OpenAlgo for Indian markets, DuckDB for direct database access (custom or OpenAlgo Historify format), yfinance for US and global data, and CCXT for crypto, with API keys loaded from a single root .env via find_dotenv.
Fees are auto-selected by market: Indian markets use STT plus statutory charges and a fixed per-order amount, with separate cost models for US and crypto. Every backtest also produces a Strategy versus Benchmark comparison table.
Plotly candlestick charts use xaxis type category to avoid weekend gaps in the chart, and they use the plotly_dark template.
Quick Setup:
.claude/skills/Repository
marketcalls/vectorbt-backtesting-skills