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/optimize-parameters.md
View on GitHub---
name: optimize-parameters
description: Grid search to find optimal strategy parameters
allowed-tools: Read, Write, Edit, Bash(python:*)
---
# /optimize-parameters
Find optimal strategy parameters via grid search over historical data.
## Usage
```
/optimize-parameters <strategy_name> <symbol> <param_grid> [options]
```
## How It Works
The optimizer in `${CLAUDE_SKILL_DIR}/scripts/optimize.py` runs a full backtest for every combination of parameters in your grid, ranks results by a target metric (default: Sharpe ratio), and reports the top performers.
## Examples
Optimize SMA crossover periods:
```bash
python ${CLAUDE_SKILL_DIR}/scripts/optimize.py \
--strategy sma_crossover --symbol BTC-USD --period 2y \
--param-grid '{"fast_period": [10, 15, 20, 30], "slow_period": [50, 100, 150, 200]}'
```
Optimize RSI thresholds targeting win rate:
```bash
python ${CLAUDE_SKILL_DIR}/scripts/optimize.py \
--strategy rsi_reversal --symbol ETH-USD --period 1y \
--param-grid '{"period": [7, 14, 21], "overbought": [65, 70, 75], "oversold": [25, 30, 35]}' \
--metric win_rate
```
Optimize with custom capital and output:
```bash
python ${CLAUDE_SKILL_DIR}/scripts/optimize.py \
--strategy macd --symbol SOL-USD --period 1y \
--param-grid '{"fast": [8, 12, 16], "slow": [20, 26, 32], "signal": [7, 9, 11]}' \
--capital 50000 --output ./my-reports
```
## Options
| Flag | Description | Default |
|------|-------------|---------|
| `--strategy` | Strategy name | Required |
| `--symbol` | Trading symbol | Required |
| `--param-grid` | JSON dict of param lists | Required |
| `--period` | Lookback period | `1y` |
| `--start/--end` | Explicit date range | -- |
| `--capital` | Starting capital | `10000` |
| `--metric` | Sort/rank metric | `sharpe_ratio` |
| `--output` | Output directory | `${CLAUDE_SKILL_DIR}/reports` |
## Available Metrics
`total_return`, `sharpe_ratio`, `sortino_ratio`, `max_drawdown`, `win_rate`, `profit_factor`, `calmar_ratio`, `total_trades`
## Output
- Console table of top 10 parameter combinations
- `optimization_<strategy>_<timestamp>.csv` -- Full results grid
- `optimization_<strategy>_<timestamp>.txt` -- Formatted summary
## Tips
- Start with coarse grids, then narrow around promising values
- Use at least 1-2 years of data to avoid overfitting
- Watch for parameter sets that have very few trades (unreliable statistics)
- Compare in-sample optimization with out-of-sample validation (see `/walk-forward`)
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 |