strategy-compare
marketcalls/vectorbt-backtesting-skills
Compare multiple trading strategies side-by-side with performance metrics and equity curves.
What is strategy-compare?
Backtests and compares multiple trading strategies (long, short, or both) on the same stock symbol using OpenAlgo indicators. Generates a comparison table with key metrics like Sharpe ratio, max drawdown, and win rate, plus overlaid equity curve plots.
- Fetch historical data via OpenAlgo or DuckDB
- Run multiple strategies (EMA crossover, RSI, Donchian, Supertrend) on identical data
- Generate side-by-side performance metrics table with Sharpe, Sortino, max drawdown, win rate, and profit factor
- Include NIFTY benchmark comparison in results
- Plot overlaid equity curves for all strategies using Plotly
- Export comparison results to CSV
How to install strategy-compare
npx skills add https://github.com/marketcalls/vectorbt-backtesting-skills --skill strategy-compare- OpenAlgo installed and configured (or DuckDB path with pre-loaded data)
- Python environment with vectorbt, pandas, plotly
- Historical OHLCV data for the target symbol
How to use strategy-compare
- 1.Run the skill with a symbol and strategy names: `/strategy-compare RELIANCE ema-crossover rsi donchian`
- 2.If no strategies specified, defaults to comparing: ema-crossover, rsi, donchian, supertrend
- 3.Use `long-vs-short` flag to compare long-only vs short-only vs both directions
- 4.Review the generated comparison table showing metrics for each strategy vs NIFTY benchmark
- 5.Examine the Plotly equity curve plot to visualize strategy performance over time
- 6.Check the exported CSV file in `backtesting/strategy_comparison/` for detailed results
Use cases
- Compare which technical indicator strategy performs best on a specific stock
- Evaluate long vs short trading performance on the same symbol
- Benchmark your strategy against NIFTY index returns
- Analyze strategy robustness across different market conditions
- Select the highest Sharpe ratio strategy before live trading
- Quantitative traders evaluating multiple strategies
- Retail investors backtesting technical indicators
- Algo traders optimizing strategy selection
- Financial analysts comparing trading approaches
strategy-compare FAQ
EMA crossover, RSI, Donchian, and Supertrend by default. The skill uses OpenAlgo ta library for all indicators, with TA-Lib only if explicitly requested.
Yes. Include 'long-vs-short' in your strategy list to compare long-only, short-only, and both directions for the first strategy.
Yes. The comparison table automatically includes NIFTY index performance (via OpenAlgo NSE_INDEX) alongside your strategy metrics.
For Indian delivery equity, the skill applies 0.00111 (0.111%) proportional fees plus ₹20 fixed fees per trade.
Yes. Provide a DuckDB path and the skill will load data directly instead of fetching from OpenAlgo.
Full instructions (SKILL.md)
Source of truth, from marketcalls/vectorbt-backtesting-skills.
name: strategy-compare description: Compare multiple strategies or directions (long vs short vs both) on the same symbol. Generates side-by-side stats table. argument-hint: "[symbol] [strategies...]" allowed-tools: Read, Write, Edit, Bash, Glob, Grep
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
- Read the vectorbt-expert skill rules for reference patterns
- Create
backtesting/strategy_comparison/directory if it doesn't exist (on-demand) - Create a
.pyfile inbacktesting/strategy_comparison/named{symbol}_strategy_comparison.py - The script must:
- Fetch data once via OpenAlgo
- If user provides a DuckDB path, load data directly via
duckdb.connect(path, read_only=True). See vectorbt-expertrules/duckdb-data.md. - If
openalgo.tais not importable (standalone DuckDB), use inlineexrem()fallback. - Use OpenAlgo ta for ALL indicators by default (never VectorBT built-in). Only switch to TA-Lib if the user explicitly says "talib"/"TA-Lib"
- Always use OpenAlgo ta for specialty indicators (Supertrend, Donchian, etc.) - no TA-Lib equivalent exists
- Clean signals with
ta.exrem()(always.fillna(False)before exrem) - Run each strategy on the same data
- Indian delivery fees:
fees=0.00111, fixed_fees=20for delivery equity - Collect key metrics from each into a side-by-side DataFrame
- Include NIFTY benchmark in the comparison table (via OpenAlgo
NSE_INDEX) - Print Strategy vs Benchmark comparison table: Total Return, Sharpe, Sortino, Max DD, Win Rate, Trades, Profit Factor
- Explain results in plain language - which strategy performed best and why
- Plot overlaid equity curves for all strategies using Plotly (
template="plotly_dark") - Save comparison to CSV
- Never use icons/emojis in code or logger output
Example Usage
/strategy-compare RELIANCE ema-crossover rsi donchian
/strategy-compare SBIN long-vs-short ema-crossover
Related skills
More from marketcalls/vectorbt-backtesting-skills and the wider catalog.

vectorbt-expert
VectorBT backtesting expert for strategy testing, signal generation, and portfolio optimization.

backtest
Generate complete backtesting scripts for trading strategies with data fetch, signals, stats, and plots.

optimize
Optimize trading strategy parameters using VectorBT with heatmap visualization and benchmark comparison.

quick-stats
Quickly backtest a symbol with EMA crossover strategy and print key stats inline—no file creation.

claude-brainrot
Always-on meme dropper that fires image+sound combos and sound-only hits automatically on every user message.

asr
Transcribe audio files to text offline using local speech recognition models.