PluginBench
Skill
Review
Audit score 70

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
Prerequisites
  • OpenAlgo connection or DuckDB database with OHLC data
  • TA-Lib installed for technical indicator computation
  • Plotly for visualization
  • vectorbt for backtesting engine
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.Or use long-vs-short mode: `/strategy-compare SBIN long-vs-short ema-crossover`
  3. 3.Or use defaults with just a symbol: `/strategy-compare NIFTY`
  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 relative performance over time
  6. 6.Check the CSV output file in `backtesting/strategy_comparison/` for detailed results
  7. 7.Use the plain-language explanation to understand which strategy performed best and why

Use cases

Good for
  • 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
Who it's for
  • 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

What happens if I only provide a symbol with no strategies?

The skill defaults to comparing four strategies: ema-crossover, rsi, donchian, and supertrend.

How does long-vs-short mode work?

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.

Can I use my own DuckDB data instead of OpenAlgo?

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.

What fees are applied for Indian equity delivery?

The skill automatically applies delivery equity fees of 0.00111 (0.111%) plus a fixed fee of 20 per trade.

What metrics are included in the comparison table?

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

  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 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=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