backtest-expert
Skill4 starsChanged 2 months agoMITView on GitHub
Use this skill to simulate how a trading rule would have performed on historical price data — win rate, average return, max drawdown, profit factor — from a CSV or list of prices the user supplies, no market-data API required. Trigger on "backtest this strategy", "ทดสอบกลยุทธ์ย้อนหลัง", "how would this rule have performed historically", "moving average crossover backtest", "max drawdown of this strategy". If the user wants to size a position or apply a risk gate on a trade they're about to take, use position-sizer/drawdown-circuit-breaker instead — this skill evaluates a rule against the past, not a single upcoming trade.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- IngAs8/ClaudeSkilltheir own version, first seen Sep 28, 2026
- Wind-Alice/AliceMarkettheir own version, first seen Apr 28, 2026
- ajeeshworkspace/indian-trading-skillstheir own version, first seen Mar 12, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- Wind-Alice/AliceMarket★ 147same name
- ajeeshworkspace/indian-trading-skills★ 75same name
- IngAs8/ClaudeSkill★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository58 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/project-docs-prep/templates/AGENTS.mdAGENTS.md
- skills/project-docs-prep/templates/CLAUDE.mdCLAUDE.md
- deep-planningSkill
- deep-planningSkill
- deprecatedSkill
- architecture-reviewSkill
- code-reviewSkill
- diagnoseSkill
- tddSkill
- ui-design-engineeringSkill
- ux-ui-design-assessmentSkill
- in-progressSkill
- mcp-tool-managementSkill
- skill-managementSkill
- obsidian-canvasSkill
- obsidian-markdownSkill
- obsidian-notion-bridgeSkill
- obsidian-vault-workflowSkill
- boomz-preferencesSkill
- personal-agent-workflowSkill
- personalSkill
- automation-designSkill
- grill-with-docsSkill
- handoffSkill
- inbox-meeting-triageSkill
- markdown-reportSkill
- prompt-improvementSkill
- project-docs-prepSkill
- claim-citation-checkSkill
- daily-news-reportSkill
- github-skill-researchSkill
- project-discoverySkill
- repo-tourSkill
- research-methodologySkill
- seo-website-evaluatorSkill
- thaiSkill
- thai-addressSkill
- thai-customer-serviceSkill
- thai-date-formatSkill
- thai-festival-cardSkill
- thai-government-formSkill
- thai-id-validateSkill
- thai-invoiceSkill
- thai-pdpaSkill
- thai-resumeSkill
- thai-social-captionSkill
- thai-text-processingSkill
- thai-translateSkill
- dividend-value-screenerSkill
- drawdown-circuit-breakerSkill
- exposure-coachSkill
- market-breadth-analyzerSkill
- portfolio-managerSkill
- position-sizerSkill
- tradingSkill
- trader-memory-coreSkill
- uptrend-analyzerSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 50
Not accounting for what this backtest excludes: no commissions, slippage, taxes, or bid-ask spread by default — real returns will be lower …
- Very specific: line 59
Run python3 backtest.py for the self-test (includes a fully hand-verified trade sequence and a hand-verified MA-crossover signal sequence, …
- Distinctive: line 63
No commissions, slippage, spread, taxes, shorting, position sizing, or multi-position support — this is a minimal long-only single-position …
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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 |
An open position at the end of the data (a "buy" with no later "sell") is not counted as a completed trade and is flagged separately (open_position_at_end) — don't silently drop it from the report.
Moving-average crossover signal generator: a simple, common way to produce buy/sell signals mechanically instead of supplying them by hand. fast_period/slow_period are trailing-window sizes (in bars); a "buy" fires the first bar the fast MA moves above the slow MA, "sell" the first bar it moves below. No lookahead — each bar's MA only uses that bar and earlier ones. Bars without enough history for both MAs get "hold".
Common mistakes
- Tuning the fast/slow period (or any rule parameter) by trying many values against the same historical sample and keeping whichever looks best — that's curve-fitting, not validation; the resulting metrics describe how well the rule was fit to this data, not how it will perform on new data.
- Treating a high win rate as good on its own — a rule with a 70% win rate and rare large losses can still have a negative profit factor; report win rate, average return, and profit factor together, not in isolation.
- Ignoring
open_position_at_end— a trade still open when the data ends isn't a loss or a win, it's incomplete; don't fold it into win rate as either. - Applying this long-only, single-position engine to a strategy that actually shorts, pyramids, or holds multiple concurrent positions — the metrics would silently misrepresent a strategy this engine can't actually simulate.
- Not accounting for what this backtest excludes: no commissions, slippage, taxes, or bid-ask spread by default — real returns will be lower than a raw backtest suggests, especially for a rule with many trades.
Code
backtest.py — Decimal arithmetic, no dependencies:
run_backtest(bars)→BacktestResult(trades, total_trades, win_rate, avg_return_pct, total_return_pct, max_drawdown_pct, profit_factor, open_position_at_end), wherebarsis a chronological list of{"date", "price", "signal"}generate_ma_crossover_signals(prices, fast_period, slow_period)→ the same list with a"signal"key added, ready to feed intorun_backtest
Run python3 backtest.py for the self-test (includes a fully hand-verified trade sequence and a hand-verified MA-crossover signal sequence, not just round-trip assertions).
Known limitations
- No commissions, slippage, spread, taxes, shorting, position sizing, or multi-position support — this is a minimal long-only single-position simulator, not a full trading-system backtester.
- Says nothing about statistical significance — a handful of trades on one historical window is a small sample; treat a backtest over a short period or few trades as weak evidence, not proof a rule works.
- Overfitting is a real, easy-to-fall-into trap: if the rule's parameters were chosen by testing many variants against this same data, the reported metrics are optimistic. A rule validated on data it was never tuned against (out-of-sample / walk-forward testing) is much stronger evidence — this skill does not enforce that discipline for you.
- Past performance shown by any backtest, however carefully done, does not guarantee future results.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

