strategy-compare
Side-by-side backtesting comparison of multiple trading strategies on the same symbol.
- Compares user-specified strategies (or defaults to ema-crossover, rsi, donchian, supertrend) against the same historical data and NIFTY benchmark
- Supports "long-vs-short" mode to test longonly, shortonly, and both directions for a given strategy
- Uses TA-Lib for standard indicators and OpenAlgo ta for specialty indicators like Supertrend and Donchian; cleans signals with exrem() to avoid consecutive duplicates
- Generates a side-by-side metrics table (Total Return, Sharpe, Sortino, Max DD, Win Rate, Trades, Profit Factor) and overlaid Plotly equity curves; includes plain-language explanation of which strategy performed best
- Applies Indian delivery equity fees (0.00111 + 20 fixed) and loads data from OpenAlgo or DuckDB depending on availability
Create a strategy comparison script.
Arguments
Parse $ARGUMENTS as: symbol followed by strategy names
$0= symbol (e.g., SBIN, RELIANCE, NIFTY)- Remaining args = strategies to compare (e.g., ema-crossover rsi donchian)
If only a symbol is given with no strategies, compare: ema-crossover, rsi, donchian, supertrend. If "long-vs-short" is one of the strategies, compare longonly vs shortonly vs both for the first real strategy.
Instructions
More from marketcalls/vectorbt-backtesting-skills
backtest
Quick backtest a strategy on a symbol. Creates a complete .py script with data fetch, signals, backtest, stats, and plots.
1.3Kvectorbt-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.
912quick-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.
832setup
Set up the Python backtesting environment. Detects OS, creates virtual environment, installs dependencies (openalgo, ta-lib, vectorbt, plotly), and creates the backtesting folder structure.
792