본문으로 건너뛰기
cccskills
무료GitHub에 공개

backtest-expert

Plan and assess backtests, which test trading rules against historical data. Examine sensitivity to rule changes, trading costs, and data bias, then use supplied performance metrics to generate a structured evaluation with reasons that block adoption.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

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.

설치 방법 보기

이럴 때 유용합니다

  • Define a backtesting plan for rule-based trading
  • Test sensitivity to parameters and trading costs
  • Investigate suspiciously strong backtest results
  • Create an evaluation report from performance metrics

포함된 파일(7)

  • SKILL.md10.3 KB
  • references/failed_tests.md7.6 KB
  • references/methodology.md7.1 KB
  • requirements.txt70 B
  • scripts/evaluate_backtest.py22.2 KB
  • scripts/tests/conftest.py690 B
  • scripts/tests/test_evaluate_backtest.py35.6 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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). Treat the machine-readable decision and blocking_reasons as authoritative. The 0–100 quality_score is diagnostic: even a high score cannot override non-positive expectancy (except that fewer than 30 trades yields NOT_EVALUABLE first), a 50% or greater drawdown, a stricter user-supplied drawdown limit, insufficient trades, missing slippage/friction validation, a test period shorter than five years, or results that look too good (win rate above 90% with max drawdown below 5%, reason too_good, which needs a look-ahead and data audit before adoption). verdict remains a conservative Deploy/Refine/Abandon compatibility field that is never better than the score-based verdict. Use --max-acceptable-drawdown-pct to set a personal limit below the hard 50% ceiling; equality with the personal limit is allowed. Invalid inputs exit with status 1 and no report.

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, decision, blocking_reasons, and verdict
  • reports/backtest_eval_<timestamp>.md — human-readable report with dimension table, key metrics, and red flag details

Key JSON fields:

  • decision: authoritative result, one of DEPLOY, REFINE, ABANDON, REJECT, RISK_LIMIT_EXCEEDED, VALIDATION_REQUIRED, NOT_EVALUABLE. Gate precedence: NOT_EVALUABLE (fewer than 30 trades or profit-factor overflow), then REJECT, then RISK_LIMIT_EXCEEDED, then VALIDATION_REQUIRED (no slippage test, under 5 years, or too_good). Only when no gate blocks does the score yield DEPLOY/REFINE/ABANDON.
  • blocking_reasons: IDs of every gate that fired (profit_factor_overflow, small_sample, negative_expectancy, zero_expectancy, excessive_drawdown, risk_limit_exceeded, no_slippage_test, short_test_period, too_good); all are preserved even when a higher-precedence gate sets the decision.
  • profit_factor: may be null. profit_factor_status explains why: FINITE (numeric value), NO_LOSSES (positive gross profit, no gross loss), UNDEFINED_ZERO_GROSS (no gross profit and no gross loss), or OVERFLOW (ratio overflow despite nonzero losses).

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 platform's quirks (interpolation methods, handling of low liquidity, data alignment issues).

Statistical significance: Small edges require large sample sizes to prove. 5% edge per trade needs 100+ trades to distinguish from luck.

Discretionary vs Systematic Differences

This skill focuses on systematic/quantitative backtesting where:

  • All rules are codified in advance
  • No discretion or "feel" in execution
  • Testing happens on all historical examples, not cherry-picked cases
  • Context (news, macro) is deliberately stripped out

Discretionary traders study differently—this skill may not apply to setups requiring subjective judgment.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Analyze chart images showing how broadly US stocks are participating in market trends. Assess medium-term conditions and short-term signals, then produce an English report with positioning guidance, alternative scenarios, and risks based on the visible data.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Assessing the market cycle from an S&P 500 breadth chart
  • Checking short-term signals in an uptrend stock ratio chart
  • Comparing medium-term and short-term market signals
tradermonty/claude-trading-skills3.2천2026년 10월 21일 업데이트

Assess how broadly US stock market gains are shared across stocks using public CSV data and optional charts. Produce English reports covering market conditions, trading signals, scenarios, and positioning for different investment timeframes.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Checking how broadly US stocks are participating in a market rise
  • Reviewing medium- to long-term market positioning
  • Assessing short-term swing trading signals
tradermonty/claude-trading-skills3.2천2026년 10월 21일 업데이트

Turn VCP screening results, which identify narrowing price swings, into breakout trade plans. Calculate entry, stop-loss, target prices, and position sizes using worst-case entries, while applying portfolio risk limits and producing Alpaca-compatible order templates.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Planning entries, stop-losses, and profit targets for VCP candidates
  • Calculating position sizes from account size and risk limits
  • Checking total portfolio risk and sector exposure
tradermonty/claude-trading-skills3.2천2026년 10월 21일 업데이트

Screen US growth stocks with William O'Neil's CANSLIM method, which evaluates seven factors including earnings, price strength, trading volume, and market direction. Receive ranked candidates with composite scores, factor breakdowns, market warnings, and data quality notes.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Find US stocks with earnings growth and price momentum
  • Compare a chosen list of stocks using CANSLIM scores
  • Screen a sector-focused stock list
tradermonty/claude-trading-skills3.2천2026년 10월 21일 업데이트

Combine three reports on crowded positions, failed reactions to news, and weekly price reversals into one trading setup status. Identify missing or invalid evidence and determine whether the setup is ready for planning.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Combine three contrarian strategy reports
  • Check which confirmations are still missing
  • Find stale or inconsistent input reports
tradermonty/claude-trading-skills3.2천2026년 10월 21일 업데이트

Screen futures markets for unusually crowded speculative positions using COT reports, which track traders’ holdings. Compare three-year and 26-week positioning measures, produce ranked reports, and identify markets for further contrarian research without generating trade signals.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Finding futures markets with crowded speculative positions
  • Checking positioning in a specific futures market
  • Reviewing weekly changes in speculative holdings
tradermonty/claude-trading-skills3.2천2026년 10월 21일 업데이트

tradermonty의 스킬 모두 보기

이 스킬의 문제 신고