# Roadmap: Macro & Sentiment Integration (Bear Market Protection)

**Status:** Planned
**Objective:** Reduce Max Drawdown (currently stuck at ~87%) by incorporating external macro-economic and sentiment indicators.

## 1. The Problem
The current strategy relies solely on internal market data (Price, Volume, RSI, MACD). It lacks awareness of external economic conditions (e.g., Dollar strength, Volatility spikes) that often trigger systemic crypto crashes. This results in the strategy holding through major "Crypto Winter" events.

## 2. Proposed Indicators

### A. DXY (US Dollar Index) - *The Liquidity Gauge*
*   **Role:** Regime Filter (Risk-On vs. Risk-Off).
*   **Logic:**
    *   **Risk-Off (High/Rising DXY):** Crypto liquidity dries up.
    *   **Action:** If DXY is above its 200-day MA (or trending up), switch strategy to "Hard Mode" (tighter stops, reduced position size, or cash).
*   **Priority:** High.

### B. VIX (CBOE Volatility Index) - *The Panic Button*
*   **Role:** Emergency Exit / Crash Detector.
*   **Logic:**
    *   **Panic (VIX Spike):** High correlation between Equities and Crypto during liquidity shocks.
    *   **Action:** If VIX spikes above a critical level (e.g., 30-35), close all long positions immediately.
*   **Priority:** Medium.

### C. Crypto Fear & Greed Index - *Sentiment Check*
*   **Role:** Profit Taking / Top Detection.
*   **Logic:**
    *   **Extreme Greed (> 90):** Market is overheated.
    *   **Action:** Tighten trailing stops or take partial profits to preserve capital before the inevitable correction.
*   **Priority:** Low (Lagging indicator).

## 3. Implementation Plan

### Phase 1: Data Acquisition
*   **Script:** `tools/fetch_macro_data.py`
*   **Task:** Update script to fetch:
    *   `DXY` (Index) from Yahoo Finance (`DX-Y.NYB`) or FRED (`DTWEXBGS`).
    *   `VIX` (Index) from Yahoo Finance (`^VIX`) or FRED (`VIXCLS`).
    *   `Fear & Greed` from Alternative.me API.
*   **Output:** Merge these columns into the main OHLCV CSV (e.g., `data/COINBASE_BTCUSD-1D_macro.csv`).

### Phase 2: Strategy Integration
*   **Script:** `strategies/strategy_activation_scores.py`
*   **Task:**
    1.  Load the new macro columns.
    2.  Implement `Regime Filter` logic (e.g., `is_risk_on = dxy < dxy_sma`).
    3.  Modify `activation_score` or `long_condition` to respect the regime.
        *   *Option A:* Hard Veto (`if not is_risk_on: entry = False`).
        *   *Option B:* Score Penalty (`score -= 20 if high_dxy`).

### Phase 3: Optimization & Validation
*   **Script:** `auto_optimize_loop.py`
*   **Task:**
    1.  Add new parameters (e.g., `i_use_dxy_filter`, `i_vix_threshold`).
    2.  Run optimization to see if the AI selects these filters to reduce Drawdown.
    3.  Verify if Max Drawdown drops significantly below 87%.