# STRATEGIES_INVENTORY.yml - Inventario de Estrategias de Trading
# Trading Platform Trading Platform
# Última actualización: 2025-12-05

metadata:
  version: "1.0.0"
  last_updated: "2025-12-05"
  description: "Catálogo de estrategias para predicción de rangos y entradas óptimas"
  objective: "Encontrar entradas R:R 3:1 (80% win) y 2:1 (90% win)"

# ============================================
# OBJETIVO PRINCIPAL
# ============================================
objectives:
  primary:
    description: "Predecir máximos y mínimos en horizontes cortos"
    horizons:
      - name: "15min"
        candles_5m: 3
        candles_15m: 1
      - name: "60min"
        candles_5m: 12
        candles_15m: 4

  targets:
    - rr_ratio: 3.0
      win_rate_target: 0.80
      profit_factor_target: 4.0
      expectancy: 2.2  # R per trade

    - rr_ratio: 2.0
      win_rate_target: 0.90
      profit_factor_target: 6.0
      expectancy: 1.7  # R per trade

# ============================================
# ESTRATEGIAS BASE
# ============================================
strategies:
  # --- SMART MONEY CONCEPTS ---
  smart_money:
    - id: "STR-SMC-001"
      name: "AMD_Phases"
      category: "structure"
      description: "Wyckoff Accumulation-Markup-Distribution phases"
      priority: "P0"
      signals:
        - "accumulation_to_markup"  # BUY
        - "distribution_to_markdown"  # SELL
        - "spring_detected"  # Strong BUY
        - "upthrust_detected"  # Strong SELL
      features_required:
        - "volume_profile"
        - "price_structure"
        - "range_analysis"
      win_rate_historical: 0.72
      best_for: "Range prediction after accumulation/distribution"
      status: "active"

    - id: "STR-SMC-002"
      name: "OrderBlocks"
      category: "structure"
      description: "Institutional order block detection"
      priority: "P0"
      signals:
        - "bullish_ob_test"
        - "bearish_ob_test"
        - "ob_break"
      features_required:
        - "impulse_detection"
        - "volume_imbalance"
      win_rate_historical: 0.68
      best_for: "Predicting support/resistance levels"
      status: "active"

    - id: "STR-SMC-003"
      name: "FairValueGaps"
      category: "structure"
      description: "Fair Value Gap detection and fill prediction"
      priority: "P1"
      signals:
        - "bullish_fvg_created"
        - "bearish_fvg_created"
        - "fvg_fill_expected"
      features_required:
        - "gap_detection"
        - "efficiency_analysis"
      win_rate_historical: 0.70
      fill_probability: 0.70
      best_for: "Predicting retracement targets"
      status: "active"

    - id: "STR-SMC-004"
      name: "LiquiditySweep"
      category: "structure"
      description: "Liquidity sweep detection for reversal prediction"
      priority: "P0"
      signals:
        - "buy_side_sweep"  # Probable reversal DOWN
        - "sell_side_sweep"  # Probable reversal UP
        - "liquidity_grab"
      features_required:
        - "equal_highs_lows"
        - "swing_points"
        - "stop_clusters"
      win_rate_historical: 0.75
      best_for: "Predicting exact max/min levels"
      status: "active"

    - id: "STR-SMC-005"
      name: "MarketStructureShift"
      category: "structure"
      description: "Market structure break detection"
      priority: "P1"
      signals:
        - "bullish_mss"
        - "bearish_mss"
        - "choch"  # Change of Character
      features_required:
        - "swing_analysis"
        - "structure_tracking"
      win_rate_historical: 0.65
      best_for: "Trend reversal confirmation"
      status: "active"

  # --- VOLATILITY STRATEGIES ---
  volatility:
    - id: "STR-VOL-001"
      name: "VCP_Pattern"
      category: "volatility"
      description: "Volatility Contraction Pattern (Minervini)"
      priority: "P1"
      signals:
        - "vcp_forming"
        - "vcp_breakout"
      features_required:
        - "range_contraction"
        - "volume_dry_up"
      win_rate_historical: 0.65
      best_for: "Predicting explosive moves after squeeze"
      status: "active"

    - id: "STR-VOL-002"
      name: "BollingerSqueeze"
      category: "volatility"
      description: "Bollinger inside Keltner squeeze"
      priority: "P1"
      signals:
        - "squeeze_on"
        - "squeeze_release_bullish"
        - "squeeze_release_bearish"
      features_required:
        - "bb_width"
        - "kc_width"
        - "momentum"
      win_rate_historical: 0.62
      best_for: "Timing breakouts after low volatility"
      status: "active"

    - id: "STR-VOL-003"
      name: "ATR_Expansion"
      category: "volatility"
      description: "ATR expansion/contraction for range prediction"
      priority: "P2"
      signals:
        - "volatility_expanding"
        - "volatility_contracting"
      features_required:
        - "atr_ratio"
        - "historical_volatility"
      win_rate_historical: 0.60
      best_for: "Adjusting position size and TP/SL"
      status: "planned"

  # --- MOMENTUM STRATEGIES ---
  momentum:
    - id: "STR-MOM-001"
      name: "RSI_Divergence"
      category: "momentum"
      description: "RSI divergence for reversal prediction"
      priority: "P1"
      signals:
        - "bullish_divergence"
        - "bearish_divergence"
        - "hidden_divergence"
      features_required:
        - "rsi_14"
        - "swing_points"
        - "divergence_detection"
      win_rate_historical: 0.68
      best_for: "Predicting reversals at extremes"
      status: "active"

    - id: "STR-MOM-002"
      name: "MACD_Histogram"
      category: "momentum"
      description: "MACD histogram momentum shifts"
      priority: "P2"
      signals:
        - "histogram_reversal"
        - "zero_line_cross"
        - "momentum_divergence"
      features_required:
        - "macd_components"
        - "histogram_slope"
      win_rate_historical: 0.58
      best_for: "Confirming trend continuation/reversal"
      status: "active"

    - id: "STR-MOM-003"
      name: "Stochastic_Extreme"
      category: "momentum"
      description: "Stochastic at oversold/overbought with confirmation"
      priority: "P2"
      signals:
        - "oversold_reversal"
        - "overbought_reversal"
      features_required:
        - "stoch_k"
        - "stoch_d"
        - "price_confirmation"
      win_rate_historical: 0.55
      best_for: "Timing entries at extremes"
      status: "planned"

  # --- TREND FOLLOWING ---
  trend:
    - id: "STR-TRD-001"
      name: "EMA_Stack"
      category: "trend"
      description: "EMA 8/21/50 alignment for trend confirmation"
      priority: "P2"
      signals:
        - "bullish_stack"
        - "bearish_stack"
        - "stack_break"
      features_required:
        - "ema_8"
        - "ema_21"
        - "ema_50"
      win_rate_historical: 0.60
      best_for: "Filtering trades with trend"
      status: "active"

    - id: "STR-TRD-002"
      name: "SuperTrend"
      category: "trend"
      description: "SuperTrend indicator for trend direction"
      priority: "P2"
      signals:
        - "supertrend_bullish"
        - "supertrend_bearish"
        - "supertrend_flip"
      features_required:
        - "atr_10"
        - "supertrend_value"
      win_rate_historical: 0.58
      best_for: "Trend direction filter"
      status: "planned"

  # --- MULTI-TIMEFRAME ---
  multi_tf:
    - id: "STR-MTF-001"
      name: "TripleScreen"
      category: "multi_timeframe"
      description: "Elder Triple Screen adaptation"
      priority: "P1"
      signals:
        - "aligned_bullish"
        - "aligned_bearish"
      timeframes:
        - "1h"  # Trend
        - "15m"  # Signal
        - "5m"  # Entry
      features_required:
        - "higher_tf_trend"
        - "signal_tf_oscillator"
        - "entry_tf_trigger"
      win_rate_historical: 0.70
      best_for: "High probability entries with confluence"
      status: "active"

    - id: "STR-MTF-002"
      name: "HTF_Confluence"
      category: "multi_timeframe"
      description: "Higher timeframe level confluence"
      priority: "P1"
      signals:
        - "htf_support_confluence"
        - "htf_resistance_confluence"
      features_required:
        - "daily_levels"
        - "4h_levels"
        - "1h_levels"
      win_rate_historical: 0.72
      best_for: "Identifying strong S/R zones"
      status: "active"

# ============================================
# ENSEMBLE CONFIGURATIONS
# ============================================
ensembles:
  - id: "ENS-001"
    name: "RangePredictionEnsemble"
    description: "Main ensemble for high/low prediction"
    components:
      ml_models:
        - model_id: "ML-RANGE-001"
          weight: 0.30
        - model_id: "ML-VOL-001"
          weight: 0.15
        - model_id: "ML-DIR-001"
          weight: 0.15
      strategies:
        - strategy_id: "STR-SMC-001"  # AMD
          weight: 0.15
        - strategy_id: "STR-SMC-004"  # Liquidity
          weight: 0.10
        - strategy_id: "STR-SMC-002"  # OrderBlocks
          weight: 0.10
        - strategy_id: "STR-MTF-001"  # TripleScreen
          weight: 0.05
    dynamic_weights: true
    weight_adjustment_rules:
      - condition: "amd_phase_clear"
        adjustment: "increase_amd_weight"
      - condition: "near_order_block"
        adjustment: "increase_ob_weight"
      - condition: "high_volatility"
        adjustment: "increase_ml_weight"

  - id: "ENS-002"
    name: "EntrySignalEnsemble"
    description: "Ensemble for optimal entry timing"
    components:
      strategies:
        - strategy_id: "STR-SMC-003"  # FVG
          weight: 0.25
        - strategy_id: "STR-MOM-001"  # RSI Div
          weight: 0.25
        - strategy_id: "STR-VOL-001"  # VCP
          weight: 0.20
        - strategy_id: "STR-MTF-002"  # HTF Confluence
          weight: 0.30
    trigger_threshold: 0.70

# ============================================
# ML MODELS FOR RANGE PREDICTION
# ============================================
ml_models:
  - id: "ML-RANGE-001"
    name: "XGBoostRangePredictor"
    type: "regression"
    framework: "XGBoost"
    description: "Predicts delta_high and delta_low"
    inputs:
      features: 45
      lookback: 50
    outputs:
      - "delta_high_15m"
      - "delta_low_15m"
      - "delta_high_60m"
      - "delta_low_60m"
    metrics_target:
      mae: "< 0.5%"
      accuracy_direction: "> 75%"
    training:
      frequency: "daily"
      min_samples: 10000
      validation: "walk_forward"
    status: "planned"

  - id: "ML-VOL-001"
    name: "LSTMVolatilityPredictor"
    type: "regression"
    framework: "PyTorch"
    description: "Predicts expected volatility for range sizing"
    inputs:
      features: 25
      sequence_length: 20
    outputs:
      - "expected_volatility_15m"
      - "expected_volatility_60m"
    metrics_target:
      mae: "< 0.3%"
    status: "planned"

  - id: "ML-DIR-001"
    name: "DirectionClassifier"
    type: "classification"
    framework: "XGBoost"
    description: "Classifies probable direction (which extreme hit first)"
    inputs:
      features: 35
    outputs:
      - "direction"  # 1=bullish, -1=bearish, 0=neutral
      - "confidence"
    metrics_target:
      accuracy: "> 70%"
      precision: "> 68%"
    status: "planned"

  - id: "ML-ENTRY-001"
    name: "OptimalEntryClassifier"
    type: "classification"
    framework: "XGBoost"
    description: "Classifies if current moment is optimal for entry"
    inputs:
      features: 50
      includes: "all_strategy_signals"
    outputs:
      - "entry_quality"  # 0-1
      - "recommended_rr"  # 2 or 3
    metrics_target:
      precision: "> 85%"
    status: "planned"

# ============================================
# FEATURES CATALOG
# ============================================
features:
  volatility:
    - name: "atr_5"
      importance: "critical"
    - name: "atr_14"
      importance: "critical"
    - name: "atr_ratio"
      importance: "critical"
    - name: "bb_width"
      importance: "high"
    - name: "bb_squeeze"
      importance: "high"
    - name: "range_5"
      importance: "medium"
    - name: "range_20"
      importance: "medium"

  structure:
    - name: "dist_to_support"
      importance: "critical"
    - name: "dist_to_resistance"
      importance: "critical"
    - name: "in_range"
      importance: "high"
    - name: "range_position"
      importance: "high"
    - name: "swing_high_dist"
      importance: "medium"
    - name: "swing_low_dist"
      importance: "medium"

  trend:
    - name: "trend_adx"
      importance: "critical"
    - name: "trend_direction"
      importance: "high"
    - name: "ema_slope_20"
      importance: "medium"
    - name: "price_vs_ema_20"
      importance: "high"
    - name: "price_vs_ema_50"
      importance: "medium"
    - name: "higher_tf_trend"
      importance: "critical"

  momentum:
    - name: "rsi_14"
      importance: "high"
    - name: "rsi_divergence"
      importance: "critical"
    - name: "macd_histogram"
      importance: "medium"
    - name: "macd_divergence"
      importance: "critical"
    - name: "momentum_10"
      importance: "medium"

  volume:
    - name: "volume_ratio"
      importance: "critical"
    - name: "volume_trend"
      importance: "medium"
    - name: "obv_slope"
      importance: "medium"
    - name: "vwap_dist"
      importance: "high"

  smc:  # Smart Money Concepts
    - name: "amd_phase"
      importance: "critical"
    - name: "accumulation_score"
      importance: "critical"
    - name: "distribution_score"
      importance: "critical"
    - name: "spring_detected"
      importance: "critical"
    - name: "upthrust_detected"
      importance: "critical"
    - name: "order_block_dist"
      importance: "high"
    - name: "fvg_nearby"
      importance: "high"
    - name: "liquidity_above"
      importance: "critical"
    - name: "liquidity_below"
      importance: "critical"

# ============================================
# BACKTESTING REQUIREMENTS
# ============================================
backtesting:
  minimum_requirements:
    data_history: "2 years"
    min_trades: 1000
    walk_forward_windows: 10
    out_of_sample_ratio: 0.3

  validation_metrics:
    - name: "win_rate"
      threshold_3_1: 0.80
      threshold_2_1: 0.90
    - name: "profit_factor"
      threshold_3_1: 4.0
      threshold_2_1: 6.0
    - name: "max_drawdown"
      threshold: 0.15
    - name: "sharpe_ratio"
      threshold: 2.0
    - name: "calmar_ratio"
      threshold: 3.0

  execution_assumptions:
    slippage: "0.05%"
    commission: "0.1%"
    fill_rate: 0.95

# ============================================
# INTEGRATION
# ============================================
integration:
  ml_engine:
    prediction_endpoint: "/api/v1/predict/range"
    batch_endpoint: "/api/v1/predict/range/batch"
    cache_ttl: 30  # seconds

  llm_agent:
    tools:
      - "get_range_prediction"
      - "get_entry_signal"
      - "explain_strategy"
      - "backtest_strategy"

  frontend:
    visualizations:
      - "predicted_range_overlay"
      - "entry_zone_highlight"
      - "strategy_signals_panel"

# ============================================
# ROADMAP
# ============================================
roadmap:
  phase_1:
    name: "Core Range Prediction"
    items:
      - "Implement XGBoostRangePredictor"
      - "Implement AMD Phase Detection"
      - "Implement Liquidity Sweep Detection"
      - "Basic backtesting"
    target: "Sprint 9-10"

  phase_2:
    name: "Strategy Ensemble"
    items:
      - "Implement remaining SMC strategies"
      - "Build RangePredictionEnsemble"
      - "Walk-forward validation"
    target: "Sprint 11"

  phase_3:
    name: "Optimization"
    items:
      - "Dynamic weight adjustment"
      - "Add LSTM volatility model"
      - "Entry timing optimization"
    target: "Sprint 12"

  phase_4:
    name: "Production"
    items:
      - "Paper trading validation"
      - "Integration with LLM Agent"
      - "Dashboard and monitoring"
    target: "Sprint 13"
