backtest-expert
Expert guidance for systematic backtesting of trading strategies. Use when developing,…
Runs a declarative strategy spec over OHLCV bars with the manifoldbt Rust engine, pairs the fill log into round trips, and emits the eight inputs the backtest-expert skill scores. Use when the user wants to execute a backtest, measure a rule they have described, obtain win rate
$ npx -y skills add tradermonty/claude-trading-skills --skill manifoldbt-backtester --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/manifoldbt-backtesterContext preview
The summary Claude sees to decide when to auto-load this skill.
Runs a declarative strategy spec over OHLCV bars with the manifoldbt Rust engine, pairs the fill log into round trips, and emits the eight inputs the backtest-expert skill scores. Use when the user wants to execute a backtest, measure a rule they have described, obtain win rate
name: manifoldbt-backtester description: Runs a declarative strategy spec over OHLCV bars with the manifoldbt Rust engine, pairs the fill log into round trips, and emits the eight inputs the backtest-expert skill scores. Use when the user wants to execute a backtest, measure a rule they have described, obtain win rate / average win / average loss / max drawdown from real bars, or feed backtest-expert with measured numbers instead of estimates.
Execute what `backtest-expert` teaches. That skill grades a backtest on five dimensions, and its prerequisites say "metrics are user-provided": it scores numbers it never produces. This skill produces them. It runs a strategy over real bars and returns the eight inputs its evaluator asks for.
The two chain in one direction: spec, run, evaluate.
Leave the verdict to `backtest-expert`. It owns the thresholds and the red flags, and this skill does not duplicate them.
everything this skill does)
A spec names indicators and one entry condition. Keep it to the smallest rule that states the hypothesis. Every added knob makes an in-sample fit easier to reach by accident, and the evaluator penalises the count.
{
"name": "sma_cross_costed",
"indicators": {
"fast": { "type": "sma", "period": 20 },
"slow": { "type": "sma", "period": 60 }
},
"entry": { "left": "fast", "op": ">", "right": "slow" },
"size": 1.0,
"stop_loss_pct": 1.5,
"fees_bps": 5.0,
"slippage_bps": 2.0
}Field reference: `references/strategy_spec.md`.
Set `fees_bps` and `slippage_bps` to realistic values before you read any result. A frictionless run scores 0 on execution realism, and over short holding periods costs decide whether an edge survives.
python3 scripts/run_backtest.py \ --spec strategy.json \ --data bars.csv \ --symbol BTCUSDT \ --json-out result.json
The script validates the spec before it touches the data, so you see a spec mistake in a second instead of after a long load.
The run prints warnings that change how you should read the result: a sample under 30 trades, a span under a year, no friction modelled, or a gap between the engine's win rate and the paired one. Each one is a reason to fix the setup and run again.
Three conditions stop the handoff instead of producing a score: no completed round trips, missing or non-finite maximum drawdown, and scratch trades. The evaluator has no scratch input, so passing a population that contains them would make its derived expectancy disagree with the completed trades.
The run ends with a command you can paste. Run it, or invoke the `backtest-expert` skill with the same figures:
python3 skills/backtest-expert/scripts/evaluate_backtest.py \ --total-trades 3854 --win-rate 20.24 \ --avg-win-pct 0.2917 --avg-loss-pct 0.2342 \ --max-drawdown-pct 99.2893 --years-tested 0 \ --num-parameters 3 --slippage-tested
Between an engine's output and the evaluator's inputs sit four conversions. Each one yields a plausible number and scores the strategy wrongly. None of them raises.
**A fill is one execution, a round trip is two.** The raw trade count runs at about twice the number of round trips. Feed fills to the sample-size dimension and you double the apparent sample, which can lift a thin backtest over a threshold it should not clear.
**Buy and sell alternate only in the simplest case.** That holds for a single-symbol long-only strategy that never scales a position. Shorting breaks it, because a sell can open. Scaling breaks it, because one exit answers several entries. A universe breaks it, because fills interleave. This skill tracks position per symbol and closes a trip when it crosses back through flat. Entry and exit quantities and cash values accumulate across that whole lifecycle; their weighted-average prices are display values, while PnL comes from the cash flows themselves.
**Costs decide small trades.** At 7 bps a side, a trade that gains 0.1% on price loses money. Expectancy comes from the win rate and the average winner together, so a gross win rate beside net averages misstates the edge. Percentages here are net of fees, and `gross_return_pct` sits alongside for inspection.
**The engine signs drawdown negative.** The evaluator wants a positive magnitude. Pass the raw value and a 38% fall scores as a flawless run.
Supported: `sma`, `ema`, `rsi` over any OHLC column; one entry condition using `>`, `<`, `>=`, `<=` against another indicator, a price column or a number; optional stop-loss and take-profit; fees and slippage in basis points; long-only.
Refused: multi-condition entries, shorting, multi-asset universes, and indicators outside the three above. The engine does all of these. This skill covers the shapes a one-sentence hypothesis produces, and rejects the rest instead of half-handling it.
validation refuses
and the trap in each conversion
Claude Trading Skills started as a personal project to use AI to improve my own trading process. Claude Trading Skills is a Claude Skills-based trading workflow toolkit for time-constrained individual investors.
Expert guidance for systematic backtesting of trading strategies. Use when developing,…
This skill should be used when analyzing market breadth charts, specifically the S&P 500…
Generate Minervini-style breakout trade plans from VCP screener output with worst-case risk…
Screen US stocks using William O'Neil's CANSLIM growth stock methodology. Use when user…
Synthesize the three Jason Shapiro contrarian-pipeline verdicts (COT crowding, news-reaction…
Detect crowded speculative positioning in CFTC futures markets (COT report analysis) to find…