backtest-expert

backtest-expert is a skill for Claude Code, Codex from ntaffzii/Skill-Agents. It costs 143 tokens per session (1,462 once invoked), scanned A, original, MIT.

A tool that tests a trading rule against historical prices. Backtesting means replaying past market data to measure how the rule would have performed.

In plain words
What is it for?
Use it to test buy and sell signals or a moving-average crossover using a CSV file or price list, and compare rule variations.
Why use it?
It replaces guesswork with figures such as win rate, average return, largest loss from a peak, and profit factor. Past results do not predict future results.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/ntaffzii/skill-agents/backtest-expert
Any agent
npx skills add ntaffzii/Skill-Agents --skill backtest-expert
Clone the repo
git clone --depth 1 https://github.com/ntaffzii/Skill-Agents

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for backtest-expert

README.md
[![agentmods](https://agentmods.dev/badge/skills/ntaffzii/skill-agents/backtest-expert.svg)](https://agentmods.dev/skills/ntaffzii/skill-agents/backtest-expert)
Your own site
<a href="https://agentmods.dev/skills/ntaffzii/skill-agents/backtest-expert"><img src="https://agentmods.dev/badge/skills/ntaffzii/skill-agents/backtest-expert.svg" alt="Measured on agentmods" height="20"></a>
Per session 143 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,462 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00143 $0.01462
Opus 5 $0.00072 $0.00731
Sonnet 5 $0.00029 $0.00292
Haiku 4.5 $0.00014 $0.00146

Measured 5d ago against content hash 8852d1fad1db, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

backtest-expert scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (backtest.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/trading/backtest-expert/SKILL.md · 67 lines

How it starts

The opening of the file, as written. The whole thing — 67 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Backtest Expert

Overview

position-sizer and drawdown-circuit-breaker manage risk once you've already decided to trade a rule — neither tells you whether the rule itself actually works. This skill fills that gap: given historical price data and a set of buy/sell signals (either supplied directly or generated from a simple moving-average crossover), it simulates the trades a long-only, one-position-at-a-time strategy would have taken and reports the standard backtest metrics.

Not financial advice. A backtest describes how a rule performed on one specific historical sample. It does not predict future performance, and a rule tuned by trial-and-error against the same data it's being "backtested" on will look better than it is (overfitting/curve-fitting) — see Known limitations.

When to use

  • ทดสอบกฎเทรดกับข้อมูลราคาย้อนหลัง ก่อนใช้เงินจริง
  • Evaluating a simple moving-average crossover (or any buy/sell signal series you already have) against historical prices
  • Comparing win rate, average return, max drawdown, and profit factor across a few rule variants on the same data

When NOT to use

  • Sizing or risk-gating a specific upcoming trade — that's position-sizer/drawdown-circuit-breaker, not this skill
  • The user wants live/real-time strategy execution — this is historical simulation only, it does not place or track live trades
  • Short selling, multi-position, or portfolio-level backtesting — this engine is long-only and one-position-at-a-time; a strategy needing more than that needs a different tool

Core knowledge

Trade simulation: long-only, one position at a time. Enters on a "buy" signal only while flat; exits on a "sell" signal only while in a position. A "buy" while already in a position, or a "sell" while flat, is a no-op — it does not pyramid into a second position or close a position that doesn't exist.

Metrics reported:

Metric Meaning
Win rate % of completed trades with a positive return
Average return Mean return % per completed trade
Total return Compounded return across all trades, starting from a normalized equity of 1.0
Max drawdown Largest peak-to-trough decline in the equity curve across the whole run — same peak/current formula as drawdown-circuit-breaker
Profit factor Gross profit ÷ gross loss (sum of winning trades' returns over the absolute sum of losing trades' returns) — undefined (None) when there are no losing trades to divide by

Read the full file on GitHub · 67 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 67 lines · 143 tokens per session scan A 8852d1fad1db

Subscribe to this mod's changes

backtest-expert is a skill published in the GitHub repository ntaffzii/Skill-Agents (4 stars, last pushed 3d ago), licensed MIT. It adds 143 tokens to every session and 1,462 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.