PluginBench
Skill
Review
Audit score 70

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
Prerequisites
  • OpenAlgo installed and configured (or DuckDB path with pre-loaded data)
  • Python environment with vectorbt, pandas, plotly
  • Historical OHLCV data for the target symbol
Claude Code
Cursor
Windsurf
Cline

How to use strategy-compare

  1. 1.Run the skill with a symbol and strategy names: `/strategy-compare RELIANCE ema-crossover rsi donchian`
  2. 2.If no strategies specified, defaults to comparing: ema-crossover, rsi, donchian, supertrend
  3. 3.Use `long-vs-short` flag to compare long-only vs short-only vs both directions
  4. 4.Review the generated comparison table showing metrics for each strategy vs NIFTY benchmark
  5. 5.Examine the Plotly equity curve plot to visualize strategy performance over time
  6. 6.Check the exported CSV file in `backtesting/strategy_comparison/` for detailed results

Use cases

Good for
  • 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
Who it's for
  • Quantitative traders evaluating multiple strategies
  • Retail investors backtesting technical indicators
  • Algo traders optimizing strategy selection
  • Financial analysts comparing trading approaches

strategy-compare FAQ

What indicators are supported?

EMA crossover, RSI, Donchian, and Supertrend by default. The skill uses OpenAlgo ta library for all indicators, with TA-Lib only if explicitly requested.

Can I compare long vs short strategies?

Yes. Include 'long-vs-short' in your strategy list to compare long-only, short-only, and both directions for the first strategy.

Is the NIFTY benchmark included?

Yes. The comparison table automatically includes NIFTY index performance (via OpenAlgo NSE_INDEX) alongside your strategy metrics.

What fees are applied?

For Indian delivery equity, the skill applies 0.00111 (0.111%) proportional fees plus ₹20 fixed fees per trade.

Can I use my own DuckDB data?

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

  1. Read the vectorbt-expert skill rules for reference patterns
  2. Create backtesting/strategy_comparison/ directory if it doesn't exist (on-demand)
  3. Create a .py file in backtesting/strategy_comparison/ named {symbol}_strategy_comparison.py
  4. 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-expert rules/duckdb-data.md.
    • If openalgo.ta is not importable (standalone DuckDB), use inline exrem() 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=20 for 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
  5. 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