wind-alice/backtest-expert

Expert guidance for systematic backtesting of trading strategies. Use when developing, testing, stress-testing, or validating quantitative trading strategies. Covers "beating ideas to death" methodology, parameter robustness testing, slippage modeling, bias prevention, and interpreting backtest results. Applicable when user asks about backtesting, strategy validation, robustness testing, avoiding overfitting, or systematic trading development.

¿Qué es backtest-expert?

backtest-expert is a Claude Code agent skill that expert guidance for systematic backtesting of trading strategies. Use when developing, testing, stress-testing, or validating quantitative trading strategies. Covers "beating ideas to death" methodology, parameter robustness testing, slippage modeling, bias prevention, and interpreting backtest results. Applicable when user asks about backtesting, strategy validation, robustness testing, avoiding overfitting, or systematic trading development.

Compatible con~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/wind-alice/alicemarket/tree/main/skills/backtest-expert

Installed? Explore more Productividad y colaboración skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Backtest Expert

Systematic approach to backtesting trading strategies based on professional methodology that prioritizes robustness over optimistic results.

Core Philosophy

Goal: Find strategies that "break the least", not strategies that "profit the most" on paper.

Principle: Add friction, stress test assumptions, and see what survives. If a strategy holds up under pessimistic conditions, it's more likely to work in live trading.

When to Use This Skill

Use this skill when:

  • Developing or validating systematic trading strategies
  • Evaluating whether a trading idea is robust enough for live implementation
  • Troubleshooting why a backtest might be misleading
  • Learning proper backtesting methodology
  • Avoiding common pitfalls (curve-fitting, look-ahead bias, survivorship bias)
  • Assessing parameter sensitivity and regime dependence
  • Setting realistic expectations for slippage and execution costs

Prerequisites

  • Python 3.9+ (for evaluation script)
  • No API keys required
  • No external data dependencies — metrics are user-provided

Workflow

1. State the Hypothesis

Define the edge in one sentence.

Example: "Stocks that gap up >3% on earnings and pull back to previous day's close within first hour provide mean-reversion opportunity."

If you can't articulate the edge clearly, don't proceed to testing.

2. Codify Rules with Zero Discretion

Define with complete specificity:

  • Entry: Exact conditions, timing, price type
  • Exit: Stop loss, profit target, time-based exit
  • Position sizing: Fixed $$, % of portfolio, volatility-adjusted
  • Filters: Market cap, volume, sector, volatility conditions
  • Universe: What instruments are eligible

Critical: No subjective judgment allowed. Every decision must be rule-based and unambiguous.

3. Run Initial Backtest

Test over:

  • Minimum 5 years (preferably 10+)
  • Multiple market regimes (bull, bear, high/low volatility)
  • Realistic costs: Commissions + conservative slippage

Examine initial results for basic viability. If fundamentally broken, iterate on hypothesis.

4. Stress Test the Strategy

This is where 80% of testing time should be spent.

Parameter sensitivity:

  • Test stop loss at 50%, 75%, 100%, 125%, 150% of baseline
  • Test profit target at 80%, 90%, 100%, 110%, 120% of baseline
  • Vary entry/exit timing by ±15-30 minutes
  • Look for "plateaus" of stable performance, not narrow spikes

Execution friction:

  • Increase slippage to 1.5-2x typical estimates
  • Model worst-case fills (buy at ask+1 tick, sell at bid-1 tick)
  • Add realistic order rejection scenarios
  • Test with pessimistic commission structures

Time robustness:

  • Analyze year-by-year performance
  • Require positive expectancy in majority of years
  • Ensure strategy doesn't rely on 1-2 exceptional periods
  • Test in different market regimes separately

Sample size:

  • Absolute minimum: 30 trades
  • Preferred: 100+ trades
  • High confidence: 200+ trades

5. Out-of-Sample Validation

Walk-forward analysis:

  1. Optimize on training period (e.g., Year 1-3)
  2. Test on validation period (Year 4)
  3. Roll forward and repeat
  4. Compare in-sample vs out-of-sample performance

Warning signs:

  • Out-of-sample <50% of in-sample performance
  • Need frequent parameter re-optimization
  • Parameters change dramatically between periods

6. Evaluate Results

Questions to answer:

  • Does edge survive pessimistic assumptions?
  • Is performance stable across parameter variations?
  • Does strategy work in multiple market regimes?
  • Is sample size sufficient for statistical confidence?
  • Are results realistic, not "too good to be true"?

Decision criteria:

  • Deploy: Survives all stress tests with acceptable performance
  • 🔄 Refine: Core logic sound but needs parameter adjustment
  • Abandon: Fails stress tests or relies on fragile assumptions

Use the evaluation script for a structured, quantitative assessment:

python3 skills/backtest-expert/scripts/evaluate_backtest.py \
  --total-trades 150 \
  --win-rate 62 \
  --avg-win-pct 1.8 \
  --avg-loss-pct 1.2 \
  --max-drawdown-pct 15 \
  --years-tested 8 \
  --num-parameters 3 \
  --slippage-tested \
  --output-dir reports/

The script scores across 5 dimensions (Sample Size, Expectancy, Risk Management, Robustness, Execution Realism), detects red flags, and outputs a Deploy/Refine/Abandon verdict.

Key Testing Principles

Punish the Strategy

Add friction everywhere:

  • Commissions higher than reality
  • Slippage 1.5-2x typical
  • Worst-case fills
  • Order rejections
  • Partial fills

Rationale: Strategies that survive pessimistic assumptions often outperform in live trading.

Seek Plateaus, Not Peaks

Look for parameter ranges where performance is stable, not optimal values that create performance spikes.

Good: Strategy profitable with stop loss anywhere from 1.5% to 3.0% Bad: Strategy only works with stop loss at exactly 2.13%

Stable performance indicates genuine edge; narrow optima suggest curve-fitting.

Test All Cases, Not Cherry-Picked Examples

Wrong approach: Study hand-picked "market leaders" that worked Right approach: Test every stock that met criteria, including those that failed

Selective examples create survivorship bias and overestimate strategy quality.

Separate Idea Generation from Validation

Intuition: Useful for generating hypotheses Validation: Must be purely data-driven

Never let attachment to an idea influence interpretation of test results.

Common Failure Patterns

Recognize these patterns early to save time:

  1. Parameter sensitivity: Only works with exact parameter values
  2. Regime-specific: Great in some years, terrible in others
  3. Slippage sensitivity: Unprofitable when realistic costs added
  4. Small sample: Too few trades for statistical confidence
  5. Look-ahead bias: "Too good to be true" results
  6. Over-optimization: Many parameters, poor out-of-sample results

See references/failed_tests.md for detailed examples and diagnostic framework.

Output

  • reports/backtest_eval_<timestamp>.json — structured evaluation with per-dimension scores, red flags, and verdict
  • reports/backtest_eval_<timestamp>.md — human-readable report with dimension table, key metrics, and red flag details

Resources

Methodology Reference

File: references/methodology.md

When to read: For detailed guidance on specific testing techniques.

Contents:

  • Stress testing methods
  • Parameter sensitivity analysis
  • Slippage and friction modeling
  • Sample size requirements
  • Market regime classification
  • Common biases and pitfalls (survivorship, look-ahead, curve-fitting, etc.)

Failed Tests Reference

File: references/failed_tests.md

When to read: When strategy fails tests, or learning from past mistakes.

Contents:

  • Why failures are valuable
  • Common failure patterns with examples
  • Case study documentation framework
  • Red flags checklist for evaluating backtests

Critical Reminders

Time allocation: Spend 20% generating ideas, 80% trying to break them.

Context-free requirement: If strategy requires "perfect context" to work, it's not robust enough for systematic trading.

Red flag: If backtest results look too good (>90% win rate, minimal drawdowns, perfect timing), audit carefully for look-ahead bias or data issues.

Tool limitations: Understand your backtesting platfo

Individual skills in this repo

This repo contains 19 individual skills — each has its own dedicated page.

wind-alice/add_to_winner_decision_skill

判断盈利仓是否适合继续加仓,并给出加仓前提、节奏安排、保护规则与停止扩张边界。适用于趋势延续、核心持仓滚动放大与强势股二次进攻场景。

wind-alice/after_close_watchlist_recap_skill

在收盘后总结自选股当日表现、驱动因素、强弱分化与次日观察点。适用于每日收盘复盘、维护自选股观察节奏、为次日盘前准备提供输入等场景。

wind-alice/a-share-primary-theme-identification

用于A股市场主线识别,聚焦市场结构 / 题材周期 / 资金行为。本skill主要用户问题回答、撰写报告、撰写金融类文章等场景。本报告输出内容较多,不适合简单对话场景。各类信息与数据的获取,可以使用wind.financial.data工具,以合理的关键字或关键字组合进行获取。每天开盘后、午盘、收盘后,用户都需要快速知道: 今天市场到底在交易什么,真正的主线是什么,情绪在什么位置,明天应该盯哪里。

wind-alice/avatar-charlie-munger-thinking

使用查理·芒格式的逆向思考、激励分析、认知偏误叠加和多学科模型检验复杂决策。用于评估商业与投资判断、组织行为、政策效果、重大选择、全民共识、失败风险,或识别论证中的单一视角和心理盲区。

wind-alice/avatar-nassim-taleb-risk

使用纳西姆·塔勒布式的尾部风险、利益共担、减法、林迪效应和杠铃策略分析不确定性。用于投资、商业、政策、职业、产品或个人决策中的出局风险、不可逆损失、脆弱性、代理问题、新旧方案比较和资源配置。

wind-alice/avatar-naval-ravikant-thinking

使用纳瓦尔·拉维坎特式的重新定义、欲望审计、特定知识和杠杆框架澄清职业、创业、财富、幸福、自由与人生选择。用于识别错误问题、冲突欲望、独特竞争力、AI替代风险、许可依赖、边际成本和长期复利方向。

wind-alice/avatar-warren-buffett-investing

使用沃伦·巴菲特式的能力圈、护城河、管理层诚信、所有者收益和资本配置框架分析企业与长期投资。用于研究公司商业模式、竞争优势、现金质量、管理层、估值、安全边际,或判断一项投资应继续研究、等待还是放弃。

wind-alice/breakout_candidate_finder_skill

批量识别突破形态成熟、量价结构健康、催化配合较好的候选股,并输出优先级、触发条件与失效边界。适用于短中线选股、盘前候选池整理、板块轮动中筛选领涨预备股等场景。

wind-alice/breakout_trade_execution_skill

围绕突破交易制定从观察、触发、跟进到失效处理的落地执行方案,兼顾量价确认、环境配合与失败撤退。适用于盘前预案、盘中突破跟踪与强势股首日执行场景。

wind-alice/bull_bear_case_builder_skill

同时搭建看多与看空逻辑,比较证据强弱、关键变量与情景路径,帮助识别核心分歧。适用于防止确认偏误、研究前辩论、投资观点校验等场景。

wind-alice/business_model_decoder_skill

把公司如何获客、交付、定价、赚钱和扩张的逻辑拆解清楚,帮助快速理解业务运转方式。适用于看不懂公司业务、研究前补基础、业务结构梳理等场景。

wind-alice/buyback_program_reviewer_skill

判断回购计划的规模、动机、执行约束与真实利好程度。适用于公司宣布回购、估值争议期、资本配置分析等场景。

wind-alice/canslim_growth_scan_skill

依据成长股框架批量筛选业绩、预期、相对强度与供需结构共振的强势标的,并输出候选分层与跟踪重点。适用于成长股猎手、趋势成长选股、候选池批量扫描等场景。

wind-alice/conference_call_takeaway_skill

提炼业绩会中的新信息、管理层语气变化、问答焦点与潜在警讯。适用于听完业绩会、阅读纪要后快速更新观点等场景。

wind-alice/daily_watchlist_morning_brief_skill

为自选股生成盘前简报,汇总隔夜公告、新闻、价格变化、事件日程与今日观察重点。适用于开盘前快速浏览重点、晨会准备、盘前设定观察顺序等场景。

wind-alice/dcf-model

Real DCF (Discounted Cash Flow) model creation for equity valuation. Retrieves financial data from SEC filings and analyst reports, builds comprehensive cash flow projections with proper WACC calculations, performs sensitivity analysis, and outputs professional Excel models with executive summaries. Use when users need to value a company using DCF methodology, request intrinsic value analysis, or ask for detailed financial modeling with growth projections and terminal value calculations.

wind-alice/dip_buy_decision_skill

判断下跌或回调中的个股是否值得承接,并给出观察区、试错条件、分批节奏与放弃标准。适用于趋势回踩、事件后回落、震荡低吸与左侧谨慎试错场景。

wind-alice/dividend_change_explainer_skill

解读分红提升、削减、暂停或恢复背后的原因、持续性与投资含义。适用于收益型投资判断、公告复盘、长期现金流跟踪等场景。

wind-alice/dividend_growth_entry_skill

寻找股息持续增长、经营质量稳定且估值回落到合理区间的候选股,并输出入场观察区、成长支撑与失效边界。适用于收益成长双目标选股、长期配置、回调布局等场景。

Skills relacionados