strategy-compare
marketcalls/vectorbt-backtesting-skills
Compare multiple trading strategies on the same symbol with side-by-side performance metrics and equity curve visualization.
What is strategy-compare?
This skill creates a backtesting comparison script for multiple strategies or directional variants (long vs short vs both) on a single stock symbol. It fetches data via OpenAlgo or DuckDB, runs each strategy through vectorbt with TA-Lib indicators, and generates a side-by-side stats table plus Plotly equity curve plots to help identify the best-performing approach.
- Compares multiple strategies (ema-crossover, rsi, donchian, supertrend) or custom strategy list on the same symbol
- Supports long-vs-short comparison mode to test directional bias on a single strategy
- Fetches OHLC data from OpenAlgo or loads directly from DuckDB
- Uses TA-Lib for all technical indicators with OpenAlgo ta for specialty indicators (Supertrend, Donchian)
- Generates side-by-side comparison table with Total Return, Sharpe, Sortino, Max Drawdown, Win Rate, Trade Count, Profit Factor
- Includes NIFTY benchmark in comparison for context
How to install strategy-compare
npx skills add https://github.com/marketcalls/vectorbt-backtesting-skills --skill strategy-compare- OpenAlgo connection or DuckDB database with OHLC data
- TA-Lib installed for technical indicator computation
- Plotly for visualization
- vectorbt for backtesting engine
How to use strategy-compare
- 1.Run the skill with a symbol and strategy names: `/strategy-compare RELIANCE ema-crossover rsi donchian`
- 2.Or use long-vs-short mode: `/strategy-compare SBIN long-vs-short ema-crossover`
- 3.Or use defaults with just a symbol: `/strategy-compare NIFTY`
- 4.Review the generated comparison table showing metrics for each strategy vs NIFTY benchmark
- 5.Examine the Plotly equity curve plot to visualize relative performance over time
- 6.Check the CSV output file in `backtesting/strategy_comparison/` for detailed results
- 7.Use the plain-language explanation to understand which strategy performed best and why
Use cases
- Backtest ema-crossover vs rsi vs donchian on RELIANCE to find the most consistent strategy
- Compare long-only vs short-only vs both directions for ema-crossover on SBIN to determine directional bias
- Evaluate default strategies (ema-crossover, rsi, donchian, supertrend) on NIFTY without specifying individual strategies
- Load pre-computed data from DuckDB and compare strategies without re-fetching from OpenAlgo
- Benchmark custom strategy performance against NIFTY index to assess alpha generation
- Quantitative traders evaluating multiple strategy variants
- Retail investors comparing directional bias (long vs short) of a single strategy
- Backtesting engineers optimizing strategy selection for live trading
- Traders using Indian equity delivery markets (applies delivery fees automatically)
strategy-compare FAQ
The skill defaults to comparing four strategies: ema-crossover, rsi, donchian, and supertrend.
When you include 'long-vs-short' as a strategy argument, the skill compares long-only, short-only, and both directions for the first real strategy provided.
Yes. If you provide a DuckDB path, the skill loads data directly from it. If openalgo.ta is not available, it uses an inline exrem() fallback for signal cleaning.
The skill automatically applies delivery equity fees of 0.00111 (0.111%) plus a fixed fee of 20 per trade.
Total Return, Sharpe Ratio, Sortino Ratio, Maximum Drawdown, Win Rate, Trade Count, and Profit Factor for each strategy plus the NIFTY benchmark.
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 TA-Lib for ALL indicators (never VectorBT built-in)
- Use OpenAlgo ta for specialty indicators (Supertrend, Donchian, etc.)
- 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 simulation, signal generation, and portfolio analysis.

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

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

quick-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.

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

asr
|