Skip to content

jeremylongshore/tons-of-skills-marketplace / plugins/crypto/trading-strategy-backtester/skills/backtesting-trading-strategies

backtesting-trading-strategies

Verified

Backtest 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".

FileKindSize
SKILL.mdskill md6.9 KB
commands/backtest-strategy.mdmarkdown3.2 KB
commands/compare-strategies.mdmarkdown2.6 KB
commands/optimize-parameters.mdmarkdown2.4 KB
commands/walk-forward.mdmarkdown4.0 KB
config/settings.yamlconfig1.4 KB
references/errors.mdmarkdown3.9 KB
references/examples.mdmarkdown3.9 KB
references/implementation.mdmarkdown4.6 KB
scripts/backtest.pyexecutablescript14.3 KB
scripts/fetch_data.pyexecutablescript4.8 KB
scripts/metrics.pyscript13.1 KB
scripts/optimize.pyexecutablescript7.5 KB
scripts/strategies.pyscript11.1 KB
tests/test_metrics.pyscript6.2 KB
tests/test_strategies.pyscript13.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`)
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 323kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 323kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 323kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall