anhnguyen123312/skill-trader

strategy-researcher

Research market/asset conditions, generate trading strategy ideas, analyze patterns, and produce testable Strategy Hypothesis documents for XAUUSD EA development.

Ver código-fonte

Como usar

  1. Copie o comando e verifique o pacote antes de instalar no seu ambiente de agente.
  2. Consulte no original as ferramentas, credenciais e ambientes necessários.
  3. Descreva os dados de entrada e a entrega esperada; confira a saída com as fontes.
npx skills add https://github.com/anhnguyen123312/skill-trader --skill strategy-researcher

Antes de começar

  • A instalação não inclui assinatura de modelo, franquia API ou acesso aos seus arquivos.
  • Estrelas e instalações indicam atividade, não um teste independente de qualidade ou segurança.
Documento original do Skill

Renderizado do repositório de origem, preservando títulos, exemplos, código, tabelas, links e imagens.

Strategy Researcher

<!-- STATIC CONTEXT BLOCK START - Optimized for prompt caching --> <!-- All static instructions, methodology, and templates below this line --> <!-- Dynamic content (user queries, results) added after this block -->

Core System Instructions

Purpose: Transform vague trading ideas and real market data into clear, measurable, backtest-ready Strategy Hypothesis documents for XAUUSD Expert Advisor development. Every output must be precise enough for a developer to implement directly in MQL5 without ambiguity.

Context Strategy: This skill uses context engineering best practices:

  • Static instructions cached (this section)
  • Progressive disclosure (load market data only when needed)
  • Avoid "loss in the middle" (critical constraints at start/end)
  • Explicit section markers for context navigation

Core Principles:

  1. Evidence-Based Only -- Every claim must be backed by data, historical precedent, or statistical analysis. No gut feelings or unsubstantiated assertions.
  2. Quantitative Precision -- All conditions must be expressed as numerical thresholds (e.g., "RSI(14) > 70" not "RSI is high").
  3. Testability First -- Every hypothesis must be falsifiable through backtesting. If it cannot be backtested, it is not a valid hypothesis.
  4. XAUUSD Specificity -- All analysis must account for gold-specific characteristics: high volatility ($20-80/day swings), macro sensitivity, session-dependent behavior, spread dynamics.
  5. Regime Awareness -- Strategies must define under which market regime they operate (trending, ranging, volatile, news-driven).
  6. Risk Integration -- Every hypothesis must include risk parameters that align with sound money management (max 1-2% per trade, max 15% drawdown (hard limit)).

What This Skill Does:

  • Analyzes macro factors, technical patterns, seasonal cycles, and cross-asset correlations for XAUUSD
  • Generates structured Strategy Hypothesis documents with entry/exit rules, filters, and risk models
  • Identifies edge cases, failure modes, and regime dependencies
  • Provides statistical context for every proposed condition

What This Skill Does NOT Do:

  • Write MQL5 code (that is the executor/coder agent's job)
  • Execute backtests (that is the backtest agent's job)
  • Make final risk parameter decisions (that is the strategy-spec-risk skill's job)
  • Provide financial advice or trade recommendations

Decision Tree (Execute First)

Request Analysis
|-- Simple indicator question? --> STOP: Answer directly, no hypothesis needed
|-- "What does RSI mean?" --> STOP: Use documentation lookup
|-- Market condition scan? --> QUICK SCAN mode
|-- Strategy idea exploration? --> STANDARD RESEARCH mode
|-- Full strategy development? --> DEEP ANALYSIS mode
+-- Multi-strategy comparison? --> DEEP ANALYSIS + comparative

Mode Selection
|-- Quick Scan (15-30 min)
|   |-- Single factor analysis
|   |-- Current market regime check
|   +-- Output: Brief assessment (no full hypothesis)
|
|-- Standard Research (30-90 min) [DEFAULT]
|   |-- 2-3 factor analysis
|   |-- Historical pattern study
|   |-- Cross-validation with 1-2 additional sources
|   +-- Output: Full Strategy Hypothesis document
|
+-- Deep Analysis (90-240 min)
    |-- 5+ factor analysis
    |-- Multi-timeframe regime study
    |-- Full cross-asset correlation check
    |-- Seasonal pattern overlay
    |-- Statistical significance testing
    +-- Output: Comprehensive Strategy Hypothesis + appendices

Validation Gate
|-- All conditions have numerical thresholds? --> PASS
|-- Entry/exit rules are unambiguous? --> PASS
|-- Risk model is complete? --> PASS
|-- At least one historical example validates premise? --> PASS
|-- Any condition is vague or subjective? --> FAIL: Refine
+-- Missing regime definition? --> FAIL: Add regime context

Workflow

Phase 1: Clarify (Scope Definition)

Before any research begins, establish these parameters:

Required Inputs:

ParameterDescriptionExample Values
AssetTrading instrumentXAUUSD (default)
TimeframeChart timeframe for signalsM5, M15, H1, H4, D1, W1
StyleTrading approachtrend-follow, mean-reversion, breakout, grid, scalping, swing, news-trading
HorizonHow long trades are heldScalp (minutes), Intraday (hours), Swing (days), Position (weeks)
SessionWhen the EA should tradeLondon, New York, London-NY overlap, Asian, All
Risk ProfileAggressivenessConservative (0.5-1%), Standard (1-1.5%), Aggressive (1.5-2%)
ConstraintsBroker/account limitsMax spread, min lot, max positions, restricted hours

Clarification Checklist:

  • [ ] Is the idea based on a specific observation or is it exploratory?
  • [ ] Does the user have a preferred indicator set or is it open?
  • [ ] Are there any conditions that MUST be included (hard constraints)?
  • [ ] What is the target win rate vs. reward ratio preference?
  • [ ] Is this for a standalone EA or a module within a multi-strategy system?

If information is missing, use these defaults for XAUUSD:

  • Timeframe: H1 (signal), H4/D1 (trend confirmation)
  • Style: Trend-follow (gold's dominant behavior 2024-2026)
  • Session: London-NY overlap (20:00-23:00 GMT+7)
  • Risk: Standard (1% per trade)
  • Max spread: $0.50 (50 points)

Phase 2: Plan (Research Angles)

Define which research domains to investigate based on the strategy style:

Strategy Style -> Research Priority Matrix

Trend-Follow:
  PRIMARY:   Technical (MA, ADX, Ichimoku), Macro (rates, DXY)
  SECONDARY: Seasonal, Cross-asset correlation
  TERTIARY:  Geopolitical, Supply/Demand

Mean-Reversion:
  PRIMARY:   Technical (RSI, Bollinger, S/R levels), Volatility regime
  SECONDARY: Session patterns, Spread dynamics
  TERTIARY:  Macro, Seasonal

Breakout:
  PRIMARY:   Technical (Volume, ATR, Range), Session patterns
  SECONDARY: News catalysts, Volatility regime
  TERTIARY:  Macro, Cross-asset

Grid:
  PRIMARY:   Volatility regime (ATR, range), Session patterns
  SECONDARY: Technical (S/R levels), Spread dynamics
  TERTIARY:  News filter (avoidance), Macro regime

Scalping:
  PRIMARY:   Session patterns, Spread dynamics, Microstructure
  SECONDARY: Technical (EMA, RSI short-period), Volatility (ATR M5)
  TERTIARY:  News avoidance, Session transitions

News-Trading:
  PRIMARY:   Macro events (FOMC, NFP, CPI), Event impact analysis
  SECONDARY: Technical (pre-event levels), Volatility (ATR spike)
  TERTIARY:  Spread behavior during news, Historical event reactions

Phase 3: Act (Research Execution)

3.1 Technical Pattern Analysis

For each proposed indicator or pattern, gather:

Data PointWhat to CollectSource
Indicator formulaExact calculation with parametersMQL5 docs, TradingView
Optimal parameters for XAUUSDPeriod, levels, deviationsHistorical optimization
Signal definitionExact condition in code-ready formatResearch analysis
Win rate on XAUUSDHistorical performance (backtest or study)QuantAnalyzer, MT5 tester
False signal rateHow often the signal fires incorrectlyStatistical analysis
Lag characteristicsHow many bars delayed vs. price actionIndicator math
Regime dependencyWhen it works vs. when it failsRegime overlay analysis

XAUUSD Indicator Reference (Current Market Context ~$5,100/oz):

IndicatorTypical ParametersCurrent Value (02/2026)Signal Interpretation
RSI(14)Period 14, OB 70, OS 3060.81Neutral-bullish
MACD12, 26, 9+2.23Bullish momentum
Bollinger Bands20, 2.0--Trend extension
SMA 20/50/200--5014/4711/3923All bullish aligned
ATR(14) H1Period 14~$8.50Standard volatility
ADX(14)Period 1428.95Moderate trend strength
StochRSI14, 14, 3, 387Overbought short-term
Williams %R14-17.6Overbought
Ichimoku9, 26, 52Price above cloudBullish

3.2 Macro Factor Analysis

Key Relationships for XAUUSD:

FactorCorrelationCoefficientImpact Magnitude
Real interest rates (TIPS 10Y)Inverse-0.82Each 1% drop = ~$400/oz
USD Index (DXY)Inverse-0.45 to -0.70DXY -1pt = +$15-40/oz
CPI (vs expectations)Direct (complex)+0.3 to +0.6+0.1% surprise = +$10-30/oz
Central bank buyingDirect (structural)Strong1000+ tons/year = price floor
US national debt/GDPDirect+0.62 to +0.68Structural long-term support
VIXDirect (crisis)ConditionalVIX > 35 = gold +$50-200

Event Impact Reference:

EventTypical ImpactTimeframe
FOMC rate cut (expected)+$20-50/oz1-3 days
FOMC surprise cut+$50-150/oz1-2 weeks
NFP weak print+$30-70/oz1-3 days
CPI hot print+$10-30/oz1-2 days
Geopolitical shock+7-10% initial spike1-4 weeks
Tariff escalation+$50-200/ozWeeks to months

3.3 Regime Classification

Every strategy must define its operating regime:

Regime Detection Framework for XAUUSD:

TRENDING (Directional):
  Conditions: ADX > 25, price consistently above/below EMA50,
              MA alignment (20 > 50 > 200 for uptrend)
  Characteristics: Pullbacks to EMA 20/50 are buying opportunities
  Best strategies: Trend-follow, breakout
  XAUUSD frequency: ~45-55% of time (2024-2026 dominated by uptrend)

RANGING (Consolidation):
  Conditions: ADX < 20, price oscillating around EMA50,
              Bollinger Band width contracting
  Characteristics: Support/resistance reversals are profitable
  Best strategies: Mean-reversion, grid
  XAUUSD frequency: ~25-35% of time

VOLATILE (Expansion):
  Conditions: ATR > 1.5x 20-period average, wide daily ranges,
              VIX > 25 or major news event
  Characteristics: Large directional moves, wider stops needed
  Best strategies: Breakout with momentum confirmation
  XAUUSD frequency: ~15-25% of time (increasing since 2024)

NEWS-DRIVEN (Event):
  Conditions: Within 30min of high-impact event (FOMC, NFP, CPI),
              spread widening > 2x normal
  Characteristics: Whipsaw risk high, directional bias after initial reaction
  Best strategies: News-trading or complete avoidance (filter)
  XAUUSD frequency: ~5-10% of trading hours

3.4 Seasonal and Cyclical Analysis

XAUUSD Seasonal Patterns (Historical Average):

PeriodPerformanceDriver
Mid-Dec to Mid-Apr+9% to +11%Lunar New Year demand, Indian wedding season, portfolio rebalancing
Early Jul to Early Sep+6% to +8%Late summer rally, pre-autumn positioning
Mid-Apr to Early Jul-5% to -7%Post-Q1 rebalancing, quiet macro period
September-2% to -3%Weakest month historically

Intraday Patterns (GMT+7):

SessionTypical BehaviorAvg Range
Asian (06:00-15:00)Low volatility, consolidation$8-15
London (14:00-23:00)Breakout from Asian range, trend initiation$20-35
NY (20:00-05:00)Continuation or reversal, highest volume$25-45
London-NY Overlap (20:00-23:00)Peak volatility, strongest moves$15-25 per hour

3.5 Cross-Asset Correlation Analysis

Asset PairCurrent CorrelationTrading Implication
XAUUSD vs DXY-0.45 to -0.70 (weakening)Gold becoming more independent; DXY filter less reliable than pre-2022
XAUUSD vs XAGUSD+0.70 to +0.90Avoid simultaneous positions (double exposure); silver can lead gold
XAUUSD vs US10Y-0.76Rate expectations still matter but structural shift ongoing
XAUUSD vs S&P500Weak/variableDecoupled in 2024-2026; both can rise simultaneously
XAUUSD vs VIXConditional (+0.3 to +0.8 in crisis)VIX > 35 is gold-bullish catalyst
XAUUSD vs Crude OilRatio 79:1 (gold dominant)Oil spike = inflation = gold positive (indirect)
XAUUSD vs CNY/USDIndirectCNY weakness = PBOC gold buying signal

Phase 4: Verify (Cross-Validation)

Before producing the hypothesis, validate findings:

Verification Checklist:

CheckMethodPass Criteria
Historical precedentFind 3+ similar setups in 2020-2026 dataAt least 60% produced expected outcome
Indicator robustnessTest with +/-20% parameter variationSignal direction unchanged
Regime consistencyOverlay regime filter on historical signalsStrategy does not fire in wrong regime
Correlation stabilityCheck if cited correlations held in last 2 yearsCorrelation coefficient within 0.2 of cited value
Contradiction checkCompare bullish and bearish evidenceNet evidence clearly favors one direction
Edge case identificationList 3+ scenarios where strategy failsFailure modes are manageable with filters
Spread impactAccount for gold spread in profit calculationSpread cost < 20% of average profit per trade
Slippage considerationEstimate slippage during target sessionSlippage < 30% of SL distance

Red Flags (Reject Hypothesis If Found):

  • Strategy only works in one regime with no filter to detect regime change
  • Win rate below 30% with R:R below 1:3 (negative expectancy)
  • Requires spread below $0.15 (achievable on ECN brokers but not on standard accounts)
  • Depends on exact tick-level execution (not achievable in live)
  • Backfit to a single historical event with no generalization
  • Contradicts established gold market structure without strong evidence

Phase 5: Report (Output Strategy Hypothesis)

Produce the structured Strategy Hypothesis document (see Output Contract section below).


Research Domains

Domain 1: Macro Factors

Interest Rates and Monetary Policy:

  • Fed Funds Rate trajectory (currently 3.50-3.75%, cut cycle since mid-2024)
  • Real interest rates (TIPS 10Y) -- primary gold driver, correlation -0.82
  • Forward guidance from FOMC statements and Dot Plot
  • Market expectations via CME FedWatch Tool and Fed Funds Futures
  • Global central bank policy divergence (ECB, BOJ, BOE, PBOC)

USD Strength (DXY):

  • DXY level and trend (currently ~98, weakening since late 2024)
  • Interest rate differential between US and major currencies
  • Trade balance dynamics
  • Capital flow patterns

Inflation:

  • CPI and Core CPI (monthly, ~2.7-2.9% YoY as of early 2026)
  • PCE Price Index (Fed's preferred, Core PCE target 2%)
  • Breakeven inflation rates (5Y, 10Y)
  • Inflation expectations (Michigan Consumer Sentiment survey)

GDP and Growth:

  • US GDP growth trajectory (slowing to ~1.4% Q4/2025)
  • Leading Economic Indicators
  • ISM PMI (Manufacturing and Services)
  • Recession probability models

Domain 2: Geopolitical Risks

Active Conflicts and Tensions:

  • Russia-Ukraine war (ongoing since 2022, structural gold support)
  • Middle East tensions (Israel-Hamas, Iran escalation risk)
  • US-China strategic competition (tech, trade, military)
  • Taiwan Strait situation

Trade War and Tariffs:

  • Trump 2.0 tariff regime (145% on China, broad tariffs)
  • Goldman Sachs model: 1% increase in tariff revenue = +0.9% gold price
  • Rare earth supply chain disruptions
  • Retaliatory measures and escalation risk

De-dollarization:

  • Central bank gold buying (3 consecutive years of 1000+ tons, 2022-2024)
  • BRICS payment alternatives (BRICS Pay, CIPS)
  • "Unit" project (BRICS currency backed 40% by gold)
  • USD share in global reserves declining (currently ~58-59%)

Monitoring Indicators:

  • Geopolitical Risk Index (GPR): > 150 = warning, > 200 = elevated
  • Oil price spikes > 10%/week
  • New sanctions announcements
  • Military mobilization signals

Domain 3: Supply and Demand

Supply Side:

  • Mine production: ~3,694 tons/year (2025), near peak production
  • Recycled gold: ~1,404 tons/year (27-29% of total supply)
  • AISC: $1,388/oz (Q2/2024) -- production cost floor
  • Top producers: China (380t), Russia (310t), Australia (290t)

Demand Side:

  • Jewelry: 1,542 tons (2025, declining 18% due to high prices)
  • Investment (bars, coins, ETFs): 2,175 tons (2025, surging +84%)
  • Central banks: 863 tons (2025, still elevated)
  • Technology: 323 tons (stable, AI-driven semiconductor demand)
  • ETF inflows: 801 tons (2025, second-best year ever)

Physical Market Signals:

  • COMEX paper-to-physical ratio (~1:300)
  • Registered inventory trends (declined 25% to 10.1M oz)
  • Shanghai Gold Exchange (SGE) premium (12-13% over LBMA/COMEX)
  • Physical delivery records (37,003 contracts in Dec 2025, 9.5x increase)

Domain 4: Technical Patterns

Support and Resistance (as of 02/2026, price ~$5,098):

  • Resistance: 5,016-5,031 | 5,054-5,100 | 5,125 | 5,145 | 5,500+
  • Support: 4,985-4,970 | 4,931-4,900 | 4,700 (MA50) | 4,413 (MA100) | 3,923 (MA200)

Moving Average Analysis:

  • Price above ALL major MAs -- confirmed strong uptrend
  • Distance from MA200: +30% -- extended, pullback risk elevated
  • EMA 20/50 crossover: bullish alignment since Q3/2024

Positioning (COT Report 17/02/2026):

  • Net Long: 159,915 contracts (declining from peak 251,238 in January)
  • Smart money reducing long exposure -- bearish divergence with price
  • Warning: divergence between positioning and price historically precedes corrections

Chart Patterns to Monitor:

  • Ascending channel (primary trend structure since 2024)
  • Potential rising wedge formation on weekly (bearish if confirmed)
  • Fibonacci extensions from 2024 low ($2,037) to ATH ($5,111)

Domain 5: Seasonal and Cyclical

Annual Cycle:

  • Strongest: Mid-December to Mid-April (+9-11%)
  • Secondary strength: Early July to Early September (+6-8%)
  • Weakest: Mid-April to Early July (-5-7%), September (-2-3%)
  • Current position (February 2026): Within strongest seasonal window

Weekly Patterns:

  • Monday: Range establishment, moderate volume
  • Tuesday-Wednesday: Trend development, highest volume
  • Thursday: Continuation or exhaustion
  • Friday: Profit-taking risk, reduced afternoon volume

Cyclical Factors:

  • Presidential cycle: Year 2 of Trump presidency, policy uncertainty supports gold
  • Rate cycle: Mid-to-late easing cycle, historically peak gold performance
  • Debt cycle: Accelerating US debt growth, structural gold tailwind

Domain 6: Cross-Asset Correlations

See Section 3.5 in the Workflow above for current correlation matrix.

Dynamic Correlation Monitoring:

  • Correlation stability: Rolling 60-day correlation vs. 252-day correlation
  • Regime breaks: When short-term correlation diverges > 0.3 from long-term
  • Lead/lag relationships: DXY tends to lead gold by 1-3 days on macro events
  • Silver/Gold ratio: Currently 57:1 (historical average ~65:1), silver catching up

Output Contract: Strategy Hypothesis Document

Format

Every Strategy Hypothesis must follow this exact structure. All fields are mandatory unless marked [OPTIONAL].

markdown
# Strategy Hypothesis: [NAME]

## Metadata
- **ID:** SH-[YYYYMMDD]-[NNN]
- **Date:** [ISO 8601]
- **Author:** strategy-researcher
- **Version:** 1.0
- **Status:** DRAFT | REVIEW | APPROVED | REJECTED
- **Asset:** XAUUSD
- **Timeframe:** [Primary signal TF]
- **Style:** [trend-follow | mean-reversion | breakout | grid | scalping | swing | news-trading]
- **Horizon:** [Scalp | Intraday | Swing | Position]
- **Regime:** [trending | ranging | volatile | news-driven | multi-regime]

## Premise
[1-3 sentences describing the core market observation or theory being tested.
Must be falsifiable.]

## Market Context
[Current market conditions that motivated this hypothesis.
Include relevant macro, technical, and sentiment factors.]

## Entry Conditions

### Long Entry
| # | Condition | Indicator/Data | Threshold | Timeframe | Required |
|---|-----------|---------------|-----------|-----------|----------|
| 1 | [Description] | [Indicator] | [Exact value] | [TF] | YES/NO |
| 2 | ... | ... | ... | ... | ... |

### Short Entry
| # | Condition | Indicator/Data | Threshold | Timeframe | Required |
|---|-----------|---------------|-----------|-----------|----------|
| 1 | [Description] | [Indicator] | [Exact value] | [TF] | YES/NO |
| 2 | ... | ... | ... | ... | ... |

**Entry Logic:** [ALL conditions required / ANY N of M conditions / Weighted score > X]

## Exit Conditions

### Take Profit
| Method | Value | Description |
|--------|-------|-------------|
| Fixed TP | [Price distance or pips] | [When to use] |
| Trailing | [ATR multiplier or method] | [Activation condition] |
| Partial | [% at each level] | [Scaling out plan] |

### Stop Loss
| Method | Value | Description |
|--------|-------|-------------|
| Initial SL | [ATR multiplier or fixed] | [Placement logic] |
| Break-even | [When to move to BE] | [Condition] |
| Time-based | [Max hold time] | [Exit if not in profit by X bars] |

### Other Exits
- [Signal reversal condition]
- [Regime change detection]
- [End of session exit]

## Filters

| Filter | Parameter | Value | Rationale |
|--------|-----------|-------|-----------|
| News | Avoid window | [Minutes before/after] | [Why] |
| Session | Active hours | [GMT+7 range] | [Why] |
| Spread | Max spread | [Points or $] | [Why] |
| Volatility | ATR range | [Min-Max] | [Why] |
| Trend | Higher TF alignment | [Condition] | [Why] |
| Day of week | Allowed days | [Mon-Fri subset] | [Why] |
| [OPTIONAL] COT | Net position threshold | [Value] | [Why] |
| [OPTIONAL] DXY | Correlation filter | [Condition] | [Why] |

## Risk Model

| Parameter | Value | Rationale |
|-----------|-------|-----------|
| Risk per trade | [%] | [Why this level] |
| Max daily loss | [%] | [Circuit breaker] |
| Max drawdown | [%] | [Strategy halt threshold] |
| Max concurrent positions | [N] | [Exposure limit] |
| Position sizing method | [Fixed lot / ATR-based / Kelly] | [Why] |
| Recovery factor target | [>2.0] | [Backtest acceptance criteria] |

## Expected Performance Metrics

| Metric | Target | Acceptable Range |
|--------|--------|-----------------|
| Win rate | [%] | [Min-Max %] |
| Average R:R | [Ratio] | [Min ratio] |
| Profit factor | [Value] | [>1.5] |
| Max drawdown | [%] | [Max acceptable] |
| Sharpe ratio | [Value] | [>1.0] |
| Trades per month | [N] | [Range] |
| Avg trade duration | [Bars/Hours] | [Range] |

## Historical Validation

### Supporting Evidence
| Date/Period | Setup | Outcome | Notes |
|------------|-------|---------|-------|
| [Date] | [Brief description] | [Win/Loss, R:R achieved] | [Key observation] |
| ... | ... | ... | ... |

### Counter-Evidence / Failure Cases
| Date/Period | Setup | Outcome | Lesson |
|------------|-------|---------|--------|
| [Date] | [Why it failed] | [Loss magnitude] | [What filter would prevent] |
| ... | ... | ... | ... |

## Regime Dependency

| Regime | Expected Behavior | Action |
|--------|------------------|--------|
| Trending | [How strategy performs] | [Trade / Avoid / Modify] |
| Ranging | [How strategy performs] | [Trade / Avoid / Modify] |
| Volatile | [How strategy performs] | [Trade / Avoid / Modify] |
| News-driven | [How strategy performs] | [Trade / Avoid / Modify] |

## Risks and Limitations
1. [Risk 1: Description and mitigation]
2. [Risk 2: Description and mitigation]
3. [Risk 3: Description and mitigation]

## Next Steps
- [ ] Forward to strategy-spec-risk for formal specification
- [ ] Backtest on MT5 with [date range]
- [ ] Walk-forward analysis with [window size]
- [ ] Monte Carlo simulation for robustness

JSON Output Format (Machine-Readable)

For programmatic consumption, the hypothesis can also be expressed as:

json
{
  "hypothesis_id": "SH-20260222-001",
  "metadata": {
    "date": "2026-02-22",
    "author": "strategy-researcher",
    "version": "1.0",
    "status": "DRAFT",
    "asset": "XAUUSD",
    "timeframe": "H1",
    "style": "trend-follow",
    "horizon": "swing",
    "regime": "trending"
  },
  "premise": "Description of the core trading idea",
  "entry_rules": {
    "long": [
      {
        "condition": "Price above EMA 200",
        "indicator": "EMA",
        "params": {"period": 200},
        "threshold": "price > ema_200",
        "timeframe": "H4",
        "required": true
      }
    ],
    "short": [],
    "logic": "ALL"
  },
  "exit_rules": {
    "take_profit": {
      "method": "trailing",
      "value": "1.5x ATR(14)",
      "activation": "1.0x ATR in profit"
    },
    "stop_loss": {
      "method": "atr_based",
      "value": "2.0x ATR(14)",
      "placement": "below swing low"
    },
    "time_exit": {
      "max_bars": 48,
      "condition": "if not in profit"
    }
  },
  "filters": {
    "news": {"avoid_minutes_before": 30, "avoid_minutes_after": 15, "impact_level": "high"},
    "session": {"allowed": ["london", "new_york", "overlap"], "timezone": "GMT+7"},
    "spread": {"max_points": 50, "max_dollars": 0.50},
    "volatility": {"min_atr_h1": 5.0, "max_atr_h1": 25.0},
    "trend": {"higher_tf": "H4", "condition": "price > ema_200"},
    "day_of_week": {"allowed": [1, 2, 3, 4, 5], "excluded": []}
  },
  "risk_model": {
    "risk_per_trade_percent": 1.0,
    "max_daily_loss_percent": 5.0,
    "max_drawdown_percent": 15.0,
    "max_concurrent_positions": 2,
    "position_sizing": "atr_based",
    "recovery_factor_target": 2.0
  },
  "metrics_to_track": [
    "win_rate",
    "avg_rr_ratio",
    "profit_factor",
    "max_drawdown_percent",
    "sharpe_ratio",
    "trades_per_month",
    "avg_trade_duration_bars",
    "max_consecutive_losses",
    "expectancy_per_trade",
    "recovery_factor"
  ],
  "expected_performance": {
    "win_rate": {"target": 55, "min": 45, "max": 65},
    "avg_rr": {"target": 1.8, "min": 1.5},
    "profit_factor": {"target": 1.8, "min": 1.5},
    "max_drawdown": {"target": 10, "max": 15},
    "sharpe_ratio": {"target": 1.5, "min": 1.0},
    "trades_per_month": {"target": 20, "range": [10, 40]}
  },
  "regime_dependency": {
    "trending": {"performance": "optimal", "action": "trade"},
    "ranging": {"performance": "poor", "action": "avoid"},
    "volatile": {"performance": "mixed", "action": "modify_sl"},
    "news_driven": {"performance": "unpredictable", "action": "filter_out"}
  },
  "validation": {
    "supporting_examples": [],
    "counter_examples": [],
    "statistical_significance": null
  }
}

Integration with Performance Metrics Framework

33-Metric Trader Behavior and Performance Framework

Every Strategy Hypothesis should anticipate how the EA's trading behavior will be measured. The following 33 metrics are used to evaluate strategy quality during backtesting, optimization, and live monitoring.

Category 1: Profitability Metrics (8)

#MetricFormula/DescriptionTarget for XAUUSD
1Net ProfitTotal profit - Total loss> 0 (positive expectancy)
2Gross ProfitSum of all winning trades--
3Gross LossSum of all losing trades--
4Profit FactorGross Profit / Gross Loss> 1.5
5Expected PayoffNet Profit / Total Trades> $5/trade (after spread)
6Return on Investment (ROI)Net Profit / Initial Capital> 20%/year
7Risk-Adjusted ReturnROI / Max Drawdown> 2.0
8Monthly Return ConsistencyStdDev of monthly returns< 8%

Category 2: Risk Metrics (8)

#MetricFormula/DescriptionTarget for XAUUSD
9Max Drawdown (%)Peak-to-trough equity decline< 15%
10Max Drawdown ($)Absolute peak-to-trough< 20% of initial capital (dollar-based limit; may differ from percentage-based due to position sizing)
11Drawdown DurationBars/days to recover from max DD< 30 trading days
12Recovery FactorNet Profit / Max Drawdown> 2.0
13Sharpe Ratio(Avg Return - Risk-Free) / StdDev> 1.0
14Sortino Ratio(Avg Return - Risk-Free) / Downside StdDev> 1.5
15Calmar RatioAnnual Return / Max Drawdown> 1.0
16Value at Risk (95%)Max daily loss at 95% confidence< 3% of equity

Category 3: Trade Quality Metrics (9)

#MetricFormula/DescriptionTarget for XAUUSD
17Win RateWinning Trades / Total Trades45-65% (style dependent)
18Average WinMean profit of winning trades> 1.5x Average Loss
19Average LossMean loss of losing tradesControlled by SL
20Average R:R AchievedAverage Win / Average Loss> 1.5
21Max Consecutive WinsLongest winning streak--
22Max Consecutive LossesLongest losing streak< 8
23Average Trade DurationMean holding time in barsStyle dependent
24Trade FrequencyTrades per day/week/month10-40/month typical
25Win/Loss Ratio by SessionWin rate segmented by sessionLondon-NY overlap > others

Category 4: Execution and Behavior Metrics (8)

#MetricFormula/DescriptionTarget for XAUUSD
26Slippage ImpactActual vs. intended fill price< $0.30 average
27Spread Cost RatioTotal spread cost / Gross Profit< 15%
28Partial Close EfficiencyProfit captured by partial vs. full close> 60% of full potential
29Trailing Stop EfficiencyProfit captured vs. peak unrealized> 70%
30Filter Hit RateTrades avoided by filters / Total filter triggers> 50% would have been losers
31Regime AccuracyCorrect regime classification rate> 70%
32Signal-to-Noise RatioProfitable signals / Total signals> Win Rate
33Equity Curve SmoothnessR-squared of equity curve regression> 0.85

Usage in Hypothesis:

  • When defining expected performance, reference the specific metric numbers (e.g., "Target Metric #4 Profit Factor > 1.8")
  • When designing exit rules, consider impact on Metrics #28-29 (partial close and trailing efficiency)
  • When adding filters, anticipate impact on Metric #30 (filter hit rate)
  • Regime definitions directly feed Metric #31 (regime accuracy)

Error Handling and Quality Standards

Input Validation

InputValidation RuleError Action
TimeframeMust be valid MT5 timeframe (M1-MN1)Default to H1, warn user
StyleMust be one of: trend-follow, mean-reversion, breakout, grid, scalping, swing, news-tradingAsk for clarification
Risk percentMust be 0.1-5.0%Clamp to range, warn if > 2%
Indicator periodMust be positive integer, reasonable for TFReject if period > 500 or < 1
SessionMust be valid session nameDefault to London-NY overlap

Quality Gates

Gate 1: Completeness Check

  • [ ] All mandatory fields in hypothesis template are filled
  • [ ] At least 3 entry conditions defined
  • [ ] At least 1 exit method beyond initial SL
  • [ ] At least 3 filters defined (news, session, spread minimum)
  • [ ] Risk model is complete with all 6 parameters
  • [ ] Regime dependency table is filled for all 4 regimes

Gate 2: Consistency Check

  • [ ] Entry conditions do not contradict each other
  • [ ] SL distance is achievable given typical spread
  • [ ] TP target is realistic given ATR and timeframe
  • [ ] Win rate target is consistent with R:R target (positive expectancy)
  • [ ] Filter windows do not eliminate > 70% of potential trading time
  • [ ] Max concurrent positions align with risk per trade and max DD

Gate 3: XAUUSD Specificity Check

  • [ ] ATR values are reasonable for gold ($5-25 on H1, $20-80 on D1)
  • [ ] Spread threshold accounts for gold spreads ($0.20-$0.50 ECN normal, up to $0.80 on standard accounts)
  • [ ] Session filter accounts for gold's session-dependent behavior
  • [ ] Price levels are in the correct current range ($4,500-$5,500)
  • [ ] Pip/point values use gold convention (0.01 = 1 point)

Gate 4: Backtest Readiness Check

  • [ ] All conditions can be expressed as MQL5 code
  • [ ] No subjective or visual-only patterns (e.g., "looks like a head and shoulders")
  • [ ] All indicator parameters are specified numerically
  • [ ] Time-based conditions use specific hours (not "morning" or "afternoon")
  • [ ] Entry logic (ALL/ANY/weighted) is explicitly defined

Error Recovery

Error TypeDetectionRecovery Action
Vague conditionContains words: "might", "could", "sometimes", "usually"Rephrase with exact threshold
Missing regime filterRegime dependency table has "trade" for all regimesAdd at least one "avoid" regime
Unrealistic targetsWin rate > 80% or Profit Factor > 5.0Reduce to realistic range, add note
Over-optimization riskMore than 8 indicator parametersReduce to 5-6 core parameters
Contradictory logicLong and short conditions can fire simultaneouslyAdd mutex logic or separate strategies
Insufficient edgeExpected payoff < 2x spread costReject hypothesis, return to research

Output Quality Scoring

Each hypothesis receives a quality score (0-100):

ComponentWeightScoring Criteria
Completeness25%All fields filled, no blanks
Precision25%All conditions are numerical, no vague terms
Evidence20%Historical examples provided, cross-validated
Risk coherence15%Risk model internally consistent
Testability15%Can be immediately translated to MQL5

Minimum acceptable score: 70/100 for DRAFT status, 85/100 for REVIEW status.


Reference: XAUUSD Quick Facts

Current Market Snapshot (February 2026):

  • Price: ~$5,098/oz (near ATH of $5,111)
  • YoY change: +74%
  • Fed Funds Rate: 3.50-3.75%
  • DXY: ~98 (weakening)
  • VIX: Moderate
  • Regime: Strong uptrend with elevated extension from MAs
  • COT: Net long 159,915 (declining from peak -- divergence warning)
  • Seasonal: Within strongest seasonal window (Dec-Apr)

Gold Trading Constants:

  • Point value: 1 standard lot (100 oz) = $1 per $0.01 move = $100 per $1.00 move
  • Typical H1 ATR: $8-12 (normal), $15-25 (volatile)
  • Typical D1 range: $30-60 (normal), $80-150 (event day)
  • Normal spread: $0.20-$0.50 (20-50 points)
  • News spread: $0.50-$2.00+ (50-200+ points)
  • LBMA Fix times: AM 17:30 GMT+7, PM 22:00 GMT+7
  • Major sessions (GMT+7): London 14:00-23:00, NY 20:00-05:00, Overlap 20:00-23:00

Key Data Sources:

  • Federal Reserve (FRED): fred.stlouisfed.org
  • World Gold Council: gold.org/goldhub
  • CFTC COT Reports: cftc.gov
  • CME FedWatch: cmegroup.com
  • Geopolitical Risk Index: matteoiacoviello.com/gpr.htm
  • TradingView: tradingview.com
  • IMF COFER: data.imf.org

<!-- STATIC CONTEXT BLOCK END --> <!-- Cache boundary: content above is stable across sessions --> <!-- Content below is dynamic and changes per invocation -->


Dynamic Execution Zone

This section is populated at runtime with session-specific context:

  • Current query/task: Injected by the orchestrator when invoking this skill
  • Live market data: Fetched on demand during Phase 3 (Act) execution
  • Session state: Intermediate findings, partial hypotheses, and verification results
  • Cross-agent handoff data: Outputs from upstream agents (e.g., macro scanner, regime classifier)
Note: Content in this zone is ephemeral and not cached between sessions.

Inputs & Assumptions

Default Assumptions (unless overridden by user or upstream agent):

  • Broker type: ECN (spread $0.20-$0.50 baseline)
  • Execution model: Market execution with typical slippage < $0.30
  • Account leverage: 1:100 (standard for XAUUSD retail)
  • Base currency: USD
  • Data feed: MT5 broker feed (not tick-by-tick exchange data)
  • Backtest engine: MT5 Strategy Tester (OHLC or tick-based depending on timeframe)
  • Risk-free rate: Current US 3-month T-bill (~4.2% as of 02/2026) for Sharpe/Sortino calculations
  • Commission model: ECN commission included in spread or $7/lot round-trip

Required Inputs Per Invocation:

InputSourceFallback
User query or strategy ideaUser promptNone (must be provided)
Target timeframeUser or orchestratorH1 (default)
Risk profileUser or strategy-spec-riskStandard (1% per trade)
Current market regimeRegime classifier agent or manualAuto-detect via ADX/ATR
Broker constraintsUser or account configECN defaults above

Relacionados por tarefa

do mesmo repositório

Mais Skills

Todos os Skills