jeremylongshore/tons-of-skills-marketplace / plugins/crypto/trading-strategy-backtester/skills/backtesting-trading-strategies
backtesting-trading-strategies
VerifiedBacktest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 6.9 KB |
| commands/backtest-strategy.md | markdown | 3.2 KB |
| commands/compare-strategies.md | markdown | 2.6 KB |
| commands/optimize-parameters.md | markdown | 2.4 KB |
| commands/walk-forward.md | markdown | 4.0 KB |
| config/settings.yaml | config | 1.4 KB |
| references/errors.md | markdown | 3.9 KB |
| references/examples.md | markdown | 3.9 KB |
| references/implementation.md | markdown | 4.6 KB |
| scripts/backtest.pyexecutable | script | 14.3 KB |
| scripts/fetch_data.pyexecutable | script | 4.8 KB |
| scripts/metrics.py | script | 13.1 KB |
| scripts/optimize.pyexecutable | script | 7.5 KB |
| scripts/strategies.py | script | 11.1 KB |
| tests/test_metrics.py | script | 6.2 KB |
| tests/test_strategies.py | script | 13.7 KB |
commands/compare-strategies.md
View on GitHub---
name: compare-strategies
description: Compare multiple strategy backtests side by side
allowed-tools: Read, Write, Edit, Bash(python:*)
---
# /compare-strategies
Run multiple strategies on the same data and compare performance side by side.
## Usage
```
/compare-strategies <symbol> [strategies...] [options]
```
## Workflow
1. Fetch data once for the symbol and period
2. Run each strategy with its default (or specified) parameters
3. Collect results into a comparison table
4. Rank by chosen metric
## Example Script
```python
import sys
from pathlib import Path
sys.path.insert(0, str(Path("${CLAUDE_SKILL_DIR}/scripts")))
from backtest import load_data, run_backtest
from fetch_data import parse_period
from datetime import datetime
# Configuration
symbol = "BTC-USD"
strategies = ["sma_crossover", "ema_crossover", "rsi_reversal", "macd",
"bollinger_bands", "breakout", "mean_reversion", "momentum"]
end = datetime.now()
start = end - parse_period("1y")
# Load data once
data_dir = Path("${CLAUDE_SKILL_DIR}/data")
data = load_data(symbol, start, end, data_dir)
data.attrs["symbol"] = symbol
# Run all strategies
results = []
for name in strategies:
try:
result = run_backtest(strategy_name=name, data=data.copy())
results.append(result)
print(f"{name:20s} Return: {result.total_return:+8.2f}% "
f"Sharpe: {result.sharpe_ratio:6.2f} "
f"MaxDD: {result.max_drawdown:+8.2f}% "
f"Trades: {result.total_trades}")
except Exception as e:
print(f"{name:20s} ERROR: {e}")
# Sort by Sharpe ratio
results.sort(key=lambda r: r.sharpe_ratio, reverse=True)
print(f"\nBest strategy: {results[0].strategy} (Sharpe: {results[0].sharpe_ratio:.2f})")
```
## CLI Approach
Run individual backtests and compare the summary files:
```bash
for strategy in sma_crossover ema_crossover rsi_reversal macd bollinger_bands; do
python ${CLAUDE_SKILL_DIR}/scripts/backtest.py \
--strategy $strategy --symbol BTC-USD --period 1y --quiet
done
```
## What to Compare
| Metric | What It Tells You |
|--------|-------------------|
| Sharpe Ratio | Best risk-adjusted return |
| Total Return | Raw profitability |
| Max Drawdown | Worst-case pain |
| Win Rate | Consistency |
| Profit Factor | Reward-to-risk per trade |
| Total Trades | Activity level / costs |
## Tips
- Always compare on the same data range and capital
- A strategy with fewer trades but higher Sharpe may be preferable to one with high return but deep drawdowns
- Consider combining uncorrelated strategies for portfolio diversification
- Use `/optimize-parameters` on the top 2-3 strategies for fine-tuning
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |