def initialize_playbook(playbook_path: str) -> Dict:
    """
    Initializes the strategy playbook.
    
    Loads the playbook from a JSON file if it exists, otherwise creates a new one 
    with default strategies. It also updates the existing playbook with any new 
    default strategies that are missing.
    """
    DEFAULT_PLAYBOOK = {
        "ADXMomentum": {
            "description": "[MOMENTUM] A classic momentum strategy that enters when ADX confirms a strong trend and MACD indicates accelerating momentum.",
            "features": ["ADX", "MACD_hist", "MACD_hist_slope", "momentum_20", "market_regime"],
            "lookahead_range": [60, 180], "dd_range": [0.20, 0.35],
            "ideal_regime": ["Strong Trending"], "asset_class_suitability": ["Any"], "ideal_macro_env": ["Any"]
        },
        "ADXTrendFilterMA": {
            "description": "[HYBRID/TREND] Uses a dual moving average system for entry signals but employs the ADX as a trend strength filter. Trades are only permitted when the ADX is above 25, avoiding choppy, non-trending markets.",
            "features": ["EMA_50", "EMA_200", "ADX", "market_regime"],
            "lookahead_range": [80, 200], "dd_range": [0.20, 0.35],
            "ideal_regime": ["Strong Trending"], "ideal_macro_env": ["Risk-On", "Risk-Off"], "asset_class_suitability": ["Indices", "Equities", "Forex Majors"]
        },
        "BOS_Momentum_Confirmation": {
            "description": "[HYBRID/BOS] This strategy identifies a Break of Structure (BOS) and confirms it with a strong momentum reading from the RSI. A bullish BOS is only valid if the RSI is also firmly in bullish territory (e.g., > 60), filtering out weak breakouts.",
            "features": ["bos_up_signal", "bos_down_signal", "RSI", "ADX", "volume"],
            "lookahead_range": [60, 160], "dd_range": [0.20, 0.35],
            "ideal_regime": ["Strong Trending"], "ideal_macro_env": ["Risk-On", "Risk-Off"], "asset_class_suitability": ["Any"]
        },
        "BasicRSIBounce": {
            "description": "[RANGING] Simple RSI bounce strategy that buys when RSI crosses above 30 and sells when crosses below 70.",
            "features": ["RSI", "ADX", "bollinger_bandwidth"],
            "lookahead_range": [20, 60], "dd_range": [0.1, 0.25],
            "ideal_regime": ["Ranging"], "asset_class_suitability": ["Any"], "ideal_macro_env": ["Neutral"]
        },
        "BreakoutVolumeConfirmation": {
            "description": "[HYBRID/BREAKOUT] Identifies a breakout of a recent fractal high/low and confirms the validity of the move with a significant spike in volume, filtering out low-conviction false breakouts.",
            "features": ["fractal_up", "fractal_down", "volume", "ATR", "ADX"],
            "lookahead_range": [60, 150], "dd_range": [0.25, 0.40],
            "ideal_regime": ["Strong Trending", "High Volatility"], "ideal_macro_env": ["Risk-On", "Risk-Off"], "asset_class_suitability": ["Equities", "Indices"]
        },
        "CHoCH_Orderblock_Entry": {
            "description": "[HYBRID/CHOCH] This strategy identifies a Change of Character (CHoCH) and then waits for price to pull back to the Fair Value Gap that initiated the CHoCH move.",
            "features": ["choch_up_signal", "choch_down_signal", "fvg_bullish_exists", "fvg_bearish_exists", "volume_spike", "DAILY_ctx_Trend"],
            "lookahead_range": [50, 130], "dd_range": [0.15, 0.25],
            "ideal_regime": ["Any"], "asset_class_suitability": ["Forex Majors", "Indices", "Crypto"], "ideal_macro_env": ["Any"]
        },
        "ClassicBollingerRSI": {
            "description": "[RANGING] A traditional mean-reversion strategy entering at the outer bands, filtered by low trend strength.",
            "features": ["bollinger_lower", "bollinger_upper", "RSI", "ADX", "market_mode"],
            "lookahead_range": [20, 70], "dd_range": [0.1, 0.2],
            "ideal_regime": ["Ranging", "Low Volatility"], "asset_class_suitability": ["Any"], "ideal_macro_env": ["Neutral"]
        },
        "DivergenceConfluenceReversal": {
            "description": "[HYBRID/REVERSAL] A high-confluence strategy that only takes a trade when MACD divergence aligns with a reading from another oscillator (Stochastic), indicating a strong area of potential reversal.",
            "features": ["MACD_hist", "rsi_bullish_divergence", "rsi_bearish_divergence", "stoch_k"],
            "lookahead_range": [60, 160], "dd_range": [0.25, 0.40],
            "ideal_regime": ["Any"], "ideal_macro_env": ["Neutral", "Risk-On", "Risk-Off"], "asset_class_suitability": ["Forex Majors"]
        },
        "DivergenceRSIConfirmation": {
            "description": "[HYBRID/REVERSAL] Identifies a completed MACD divergence and requires the RSI to be in an overbought (>70) or oversold (<30) state before entering, adding a layer of momentum confirmation.",
            "features": ["MACD_hist", "rsi_bullish_divergence", "rsi_bearish_divergence", "RSI", "ADX"],
            "lookahead_range": [50, 150], "dd_range": [0.20, 0.35],
            "ideal_regime": ["Any"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Forex Majors", "Indices"]
        },
        "DojiBollingerReversal": {
            "description": "[HYBRID/CANDLESTICK] A mean-reversion strategy that enters after a Doji candle forms on the upper or lower Bollinger Band, signaling trend exhaustion and indecision at a statistical extreme, anticipating a reversal back to the mean.",
            "features": ["is_doji", "bollinger_upper", "bollinger_lower", "ADX", "wick_to_body_ratio"],
            "lookahead_range": [25, 80], "dd_range": [0.10, 0.20],
            "ideal_regime": ["Ranging", "Low Volatility"], "ideal_macro_env": ["Neutral"], "asset_class_suitability": ["Forex Crosses", "Forex Majors"]
        },
        "DonchianBreakout": {
            "description": "[BREAKOUT] A classic breakout strategy that buys/sells when the price breaks the Donchian Channel.",
            "features": ["donchian_channel", "ATR", "ADX", "volume_spike"],
            "lookahead_range": [50, 150], "dd_range": [0.2, 0.4],
            "ideal_regime": ["Strong Trending", "High Volatility"], "asset_class_suitability": ["Commodities", "Indices"], "ideal_macro_env": ["Event-Driven", "Risk-On", "Risk-Off"]
        },
        "DynamicBreakoutMomentum": {
            "description": "[HYBRID/BREAKOUT] Trades breakouts from a Donchian Channel but filters signals with a momentum indicator (e.g., Stochastic). A breakout above the upper channel is only valid if the Stochastic %K is also crossing above 80, indicating strong buying pressure.",
            "features": ["donchian_upper", "donchian_lower", "stoch_k", "ADX", "ATR", "volume"],
            "lookahead_range": [50, 130], "dd_range": [0.20, 0.40],
            "ideal_regime": ["High Volatility", "Strong Trending"], "ideal_macro_env": ["Event-Driven"], "asset_class_suitability": ["Indices", "Commodities", "Forex Majors"]
        },
        "DynamicRangeTrader": {
            "description": "[RANGING] Buys at dynamic support and sells at dynamic resistance, using Hurst to confirm a range-bound market.",
            "features": ["support_level_20", "resistance_level_20", "RSI", "stoch_k", "hurst_exponent", "ADX"],
            "lookahead_range": [30, 80], "dd_range": [0.10, 0.20],
            "ideal_regime": ["Ranging"], "asset_class_suitability": ["Forex Crosses", "Forex Majors"], "ideal_macro_env": ["Any"]
        },
        "DynamicSR_BreakoutRSI": {
            "description": "[HYBRID/BREAKOUT] This strategy confirms a breakout of a dynamic resistance/support level (Donchian Channel) with the RSI. The breakout is only considered valid if the RSI has also crossed a key level (e.g., 60 for an upside breakout), indicating momentum is backing the move.",
            "features": ["donchian_upper", "donchian_lower", "RSI", "volume", "ATR"],
            "lookahead_range": [50, 140], "dd_range": [0.20, 0.35],
            "ideal_regime": ["Strong Trending", "High Volatility"], "ideal_macro_env": ["Risk-On", "Risk-Off"], "asset_class_suitability": ["Equities", "Indices", "Commodities"]
        },
        "DynamicSR_CandlestickReversal": {
            "description": "[HYBRID/REVERSAL] Looks for a reversal candlestick pattern (e.g., an Engulfing or Doji) forming directly at a dynamic support or resistance level (e.g., Bollinger Band), providing a strong signal for a potential reversal.",
            "features": ["bollinger_upper", "bollinger_lower", "is_engulfing", "is_doji", "ADX"],
            "lookahead_range": [40, 100], "dd_range": [0.15, 0.30],
            "ideal_regime": ["Ranging", "Weak Trending"], "ideal_macro_env": ["Neutral"], "asset_class_suitability": ["Any"]
        },
        "DynamicSR_ChannelBreakout": {
            "description": "[HYBRID/BREAKOUT] Defines a dynamic channel using Bollinger Bands and enters when the price breaks out of the bands after a period of contraction (a 'squeeze'). The breakout must be accompanied by an increase in the ADX, confirming expanding volatility.",
            "features": ["bollinger_bandwidth", "ADX", "ADX_slope", "volume", "momentum_20"],
            "lookahead_range": [50, 130], "dd_range": [0.20, 0.35],
            "ideal_regime": ["Low Volatility", "High Volatility"], "ideal_macro_env": ["Event-Driven", "Neutral"], "asset_class_suitability": ["Any"]
        },
        "DynamicSR_MACD": {
            "description": "[HYBRID/TREND] Uses a moving average (e.g., 50 EMA) as a dynamic support/resistance level. It enters on a bounce off the EMA, but only if the MACD histogram is also positive (for longs) or negative (for shorts), confirming trend momentum.",
            "features": ["EMA_50", "MACD_hist", "ADX", "DAILY_ctx_Trend"],
            "lookahead_range": [40, 120], "dd_range": [0.15, 0.25],
            "ideal_regime": ["Weak Trending", "Strong Trending"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Any"]
        },
        "EMAScalpingFractal": {
            "description": "[SCALPING] A high-frequency scalping strategy using EMA alignment and Williams Fractal for entry signals.",
            "features": ["EMA_20", "EMA_50", "fractal_up", "fractal_down", "ATR"],
            "lookahead_range": [15, 45], "dd_range": [0.1, 0.25],
            "ideal_regime": ["Weak Trending", "Strong Trending"], "asset_class_suitability": ["Forex Majors", "Indices"], "ideal_macro_env": ["Neutral"]
        },
        "ElliotWaveFibonacci": {
            "description": "[HYBRID/TREND] A confluence strategy that waits for a strong trend (high ADX), then enters on a pullback to a dynamic support level (50 EMA), anticipating the next wave of momentum.",
            "features": ["ADX", "EMA_50", "RSI", "volume"],
            "lookahead_range": [100, 250], "dd_range": [0.25, 0.40],
            "ideal_regime": ["Strong Trending"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Indices", "Equities"]
        },
        "ElliotWaveMomentum": {
            "description": "[HYBRID/TREND] Identifies a corrective pullback (proxied by a short-term counter-trend streak) within a strong primary trend and combines it with an oversold Stochastic oscillator to signal a high-probability entry for the next impulsive move.",
            "features": ["markov_streak", "stoch_k", "stoch_d", "ADX", "DAILY_ctx_Trend"],
            "lookahead_range": [80, 200], "dd_range": [0.20, 0.35],
            "ideal_regime": ["Strong Trending"], "ideal_macro_env": ["Risk-On", "Risk-Off"], "asset_class_suitability": ["Indices", "Forex Majors"]
        },
        "EmaCrossoverRsiFilter": {
            "description": "[TRENDING] Classic 50/200 EMA crossover signal, filtered by RSI for momentum confirmation.",
            "features": ["EMA_50", "EMA_200", "RSI", "ADX"],
            "lookahead_range": [60, 180], "dd_range": [0.2, 0.4],
            "ideal_regime": ["Strong Trending"], "ideal_macro_env": ["Risk-On", "Risk-Off"], "asset_class_suitability": ["Indices", "Equities", "Forex Majors"]
        },
        "EngulfingRsiScalp": {
            "description": "[SCALPING] An alternative scalping strategy using the 200 EMA for trend, entering on engulfing patterns confirmed by RSI.",
            "features": ["EMA_200", "is_engulfing", "RSI"],
            "lookahead_range": [15, 45], "dd_range": [0.1, 0.25],
            "ideal_regime": ["Weak Trending", "Strong Trending"], "ideal_macro_env": ["Neutral"], "asset_class_suitability": ["Forex Majors", "Indices"]
        },
        "EngulfingVolumeConfirmation": {
            "description": "[HYBRID/CANDLESTICK] A classic strategy that identifies a strong bullish or bearish engulfing candle and requires the candle's volume to be significantly higher than average, confirming institutional participation.",
            "features": ["is_engulfing", "volume", "ATR", "DAILY_ctx_Trend"],
            "lookahead_range": [20, 70], "dd_range": [0.10, 0.25],
            "ideal_regime": ["Any"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Equities", "Forex Majors", "Indices"]
        },
        "FVG_MA_Confluence": {
            "description": "[HYBRID/PRICE ACTION] A confluence strategy that identifies fresh Fair Value Gaps and waits for the price to enter that zone. An entry is only triggered if this zone aligns with a key dynamic S&R level like the 50 EMA.",
            "features": ["fvg_bullish_exists", "fvg_bearish_exists", "EMA_50", "RSI"],
            "lookahead_range": [40, 120], "dd_range": [0.15, 0.25],
            "ideal_regime": ["Any"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Forex Majors", "Indices"]
        },
        "FibonacciDivergenceReversal": {
            "description": "[HYBRID/REVERSAL] A counter-trend strategy that looks for bullish/bearish RSI divergence occurring at the outer Bollinger Bands, signaling potential trend exhaustion and a high-probability reversal point.",
            "features": ["bollinger_upper", "bollinger_lower", "rsi_bullish_divergence", "rsi_bearish_divergence", "ADX", "market_volatility_index"],
            "lookahead_range": [30, 90], "dd_range": [0.20, 0.35],
            "ideal_regime": ["Ranging", "Weak Trending"], "ideal_macro_env": ["Neutral"], "asset_class_suitability": ["Any"]
        },
        "FibonacciMomentum": {
            "description": "[HYBRID/TREND] Combines dynamic support levels with momentum confirmation. Enters on a bounce from the middle Bollinger Band but only if the RSI confirms the primary trend's momentum is still intact.",
            "features": ["bollinger_middle", "RSI", "DAILY_ctx_Trend", "ADX", "momentum_10"],
            "lookahead_range": [40, 120], "dd_range": [0.15, 0.30],
            "ideal_regime": ["Strong Trending", "Weak Trending"], "ideal_macro_env": ["Risk-On", "Risk-Off"], "asset_class_suitability": ["Forex Majors", "Indices", "Commodities"]
        },
        "FilteredBreakout": {
            "description": "[BREAKOUT] A hybrid that trades high-volatility breakouts but only in the direction of the long-term daily trend.",
            "features": ["ATR", "bollinger_bandwidth", "DAILY_ctx_Trend", "ADX", "hour", "anomaly_score", "RSI_slope"],
            "lookahead_range": [60, 120], "dd_range": [0.2, 0.35],
            "ideal_regime": ["High Volatility", "Strong Trending"], "ideal_macro_env": ["Event-Driven", "Risk-On", "Risk-Off"], "asset_class_suitability": ["Indices", "Commodities", "Forex Majors"]
        },
        "FvgLiquidityGrab": {
            "description": "[HYBRID/PRICE ACTION] This strategy waits for a liquidity grab (a sweep of a recent high or low) and then looks for an immediate shift in market structure (CHoCH) that leaves behind a Fair Value Gap (FVG). It enters on the retest of the FVG, anticipating a reversal.",
            "features": ["liquidity_grab_up", "liquidity_grab_down", "fvg_bullish_exists", "fvg_bearish_exists", "choch_up_signal", "choch_down_signal"],
            "lookahead_range": [50, 130], "dd_range": [0.20, 0.35],
            "ideal_regime": ["Any"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Forex Majors", "Indices", "Crypto"]
        },
        "FvgOrderblockEntry": {
            "description": "[HYBRID/PRICE ACTION] Identifies a Fair Value Gap (FVG) and waits for the price to retrace into it. The entry is confirmed by a prior liquidity grab, which acts as a proxy for an institutional orderblock.",
            "features": ["fvg_bullish_exists", "fvg_bearish_exists", "liquidity_grab_up", "liquidity_grab_down", "DAILY_ctx_Trend"],
            "lookahead_range": [40, 110], "dd_range": [0.15, 0.25],
            "ideal_regime": ["Weak Trending", "Strong Trending"], "ideal_macro_env": ["Neutral", "Risk-On", "Risk-Off"], "asset_class_suitability": ["Forex Majors", "Indices"]
        },
        "GNN_Market_Structure": {
            "description": "[SPECIALIZED] Uses a GNN to model inter-asset correlations for predictive features.",
            "features": [], "lookahead_range": [80, 150], "dd_range": [0.15, 0.3],
            "requires_gnn": True, "ideal_regime": ["Any"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Forex Majors", "Indices"]
        },
        "HeikinAshiDynamicSR": {
            "description": "[HYBRID/TREND] A visual trend-following strategy that confirms a bounce off a dynamic support/resistance level (50 EMA) with a change in Heikin-Ashi candle color.",
            "features": ["EMA_50", "ha_color", "ha_streak", "DAILY_ctx_Trend"],
            "lookahead_range": [70, 180], "dd_range": [0.20, 0.30],
            "ideal_regime": ["Strong Trending"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Any"]
        },
        "HeikinAshiMACD": {
            "description": "[HYBRID/TREND] Combines the smoothed trend visualization of Heikin-Ashi candles with the MACD indicator. A long entry is triggered when Heikin-Ashi candles turn green while the MACD histogram is also positive, signaling a potential new uptrend.",
            "features": ["ha_color", "ha_streak", "MACD_hist", "ADX"],
            "lookahead_range": [60, 160], "dd_range": [0.15, 0.25],
            "ideal_regime": ["Strong Trending", "Weak Trending"], "ideal_macro_env": ["Risk-On", "Risk-Off"], "asset_class_suitability": ["Indices", "Commodities", "Forex Majors"]
        },
        "HeikinAshiTrend": {
            "description": "[TRENDING/PRICE ACTION] A robust trend-following strategy using clean Heikin-Ashi candle signals to ride trends.",
            "features": ["ha_color", "ha_body_size", "ha_streak", "DAILY_ctx_LinRegSlope", "market_volatility_index", "ADX"],
            "lookahead_range": [60, 160], "dd_range": [0.15, 0.25],
            "ideal_regime": ["Strong Trending", "Weak Trending"], "asset_class_suitability": ["Indices", "Commodities", "Forex Majors"], "ideal_macro_env": ["Risk-On", "Risk-Off"]
        },
        "HiddenDivergenceTrend": {
            "description": "[HYBRID/DIVERGENCE] A trend-following strategy that looks for hidden divergence. In an uptrend, price makes a higher low, but the RSI makes a lower low. This signals a likely continuation of the primary trend.",
            "features": ["rsi_bullish_divergence", "rsi_bearish_divergence", "DAILY_ctx_Trend", "ADX", "EMA_50"],
            "lookahead_range": [60, 160], "dd_range": [0.15, 0.25],
            "ideal_regime": ["Weak Trending", "Strong Trending"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Any"]
        },
        "HoffmanTrendRetracement": {
            "description": "[TRENDING] Enters on the resumption of a strong trend after a pause indicated by an Inventory Retracement Bar (IRB).",
            "features": ["EMA_20_slope", "is_hoffman_irb_bullish", "is_hoffman_irb_bearish", "ADX", "ATR"],
            "lookahead_range": [60, 160], "dd_range": [0.2, 0.4],
            "ideal_regime": ["Strong Trending"], "ideal_macro_env": ["Risk-On", "Risk-Off"], "asset_class_suitability": ["Equities", "Indices", "Forex Majors"]
        },
        "ICTMarketStructure": {
            "description": "[PRICE ACTION/INSTITUTIONAL] A methodology focused on identifying liquidity zones and Fair Value Gaps (FVG).",
            "features": ["fvg_bullish_exists", "fvg_bearish_exists", "choch_up_signal", "choch_down_signal", "liquidity_grab_up", "liquidity_grab_down", "DAILY_ctx_Trend", "bos_up_signal", "bos_down_signal"],
            "lookahead_range": [40, 120], "dd_range": [0.2, 0.35],
            "ideal_regime": ["Strong Trending", "Weak Trending"], "asset_class_suitability": ["Forex Majors", "Indices"], "ideal_macro_env": ["Neutral", "Risk-On", "Risk-Off"]
        },
        "LinRegAngleConfluence": {
            "description": "[HYBRID/TREND] A confluence strategy that looks for entry signals where a Linear Regression line is respected and the price is also at a dynamic S&R level, like a Bollinger Band.",
            "features": ["linear_regression", "bollinger_middle", "RSI", "ADX"],
            "lookahead_range": [100, 250], "dd_range": [0.30, 0.45],
            "ideal_regime": ["Strong Trending"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Any"]
        },
        "LinRegAngleMomentum": {
            "description": "[HYBRID/TREND] Uses a Linear Regression line as a proxy for trend angle. An entry is triggered on a bounce from the line, confirmed by the MACD histogram ticking higher (for longs) or lower (for shorts).",
            "features": ["linear_regression", "MACD_hist", "ADX", "RSI"],
            "lookahead_range": [80, 220], "dd_range": [0.25, 0.40],
            "ideal_regime": ["Strong Trending"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Commodities", "Indices"]
        },
        "LinRegBounceStochastic": {
            "description": "[HYBRID/TREND] Enters in the direction of the primary trend when price pulls back and bounces off a dynamic trendline (Linear Regression). The entry is confirmed by the Stochastic oscillator moving out of an oversold/overbought condition.",
            "features": ["linear_regression", "stoch_k", "stoch_d", "ADX", "DAILY_ctx_Trend"],
            "lookahead_range": [60, 150], "dd_range": [0.20, 0.30],
            "ideal_regime": ["Weak Trending", "Strong Trending"], "ideal_macro_env": ["Neutral", "Risk-On", "Risk-Off"], "asset_class_suitability": ["Forex Majors", "Indices", "Equities"]
        },
        "LinRegBreakRSI": {
            "description": "[HYBRID/BREAKOUT] A classic technical analysis strategy that enters on a confirmed break of a dynamic trendline (Linear Regression). The signal is filtered by RSI, requiring it to show strong momentum.",
            "features": ["linear_regression", "RSI", "volume", "ATR"],
            "lookahead_range": [70, 180], "dd_range": [0.25, 0.40],
            "ideal_regime": ["Strong Trending"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Any"]
        },
        "MACD_RSI_Divergence": {
            "description": "[HYBRID/DIVERGENCE] A powerful reversal strategy that requires a divergence signal on BOTH the MACD and the RSI simultaneously. The price making a new high while both indicators fail to do so is a very strong signal of an impending reversal.",
            "features": ["MACD_hist", "rsi_bullish_divergence", "rsi_bearish_divergence", "volume"],
            "lookahead_range": [50, 150], "dd_range": [0.20, 0.35],
            "ideal_regime": ["Any"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Any"]
        },
        "MACDFractalBreakout": {
            "description": "[BREAKOUT] A breakout strategy that uses Williams Fractal signals for entry, qualified by MACD trend direction.",
            "features": ["MACD_hist", "fractal_up", "fractal_down", "ATR", "ADX"],
            "lookahead_range": [40, 120], "dd_range": [0.2, 0.35],
            "ideal_regime": ["Weak Trending", "Strong Trending", "High Volatility"], "ideal_macro_env": ["Neutral", "Risk-On", "Risk-Off"], "asset_class_suitability": ["Any"]
        },
        "MACDTrendFollowing": {
            "description": "[TRENDING] A classic trend-following strategy using MACD crossovers filtered by a long-term 200-period EMA.",
            "features": ["EMA_200", "MACD_line", "MACD_signal", "MACD_hist", "ADX"],
            "lookahead_range": [50, 150], "dd_range": [0.15, 0.3],
            "ideal_regime": ["Strong Trending", "Weak Trending"], "asset_class_suitability": ["Forex Majors", "Indices", "Equities"], "ideal_macro_env": ["Risk-On", "Risk-Off", "Neutral"]
        },
        "MAVolumeHybrid": {
            "description": "[HYBRID] Combines moving average crossover with volume confirmation for higher probability entries.",
            "features": ["EMA_20", "EMA_50", "volume", "volume_spike"],
            "lookahead_range": [40, 100], "dd_range": [0.15, 0.3],
            "ideal_regime": ["Weak Trending", "Strong Trending"], "asset_class_suitability": ["Any"], "ideal_macro_env": ["Any"]
        },
        "MeanReversionOscillator": {
            "description": "[RANGING] A pure mean-reversion strategy using oscillators for entry in low-volatility environments.",
            "features": ["RSI", "stoch_k", "ADX", "market_volatility_index", "close_fracdiff", "hour", "day_of_week", "wick_to_body_ratio", "hurst_exponent"],
            "lookahead_range": [20, 60], "dd_range": [0.15, 0.25],
            "ideal_regime": ["Ranging", "Low Volatility"], "ideal_macro_env": ["Neutral"], "asset_class_suitability": ["Forex Crosses", "Forex Majors"]
        },
        "MeanReversionZScore": {
            "description": "[MEAN REVERSION] Exploits statistical deviations from the mean, entering when RSI reaches an extreme Z-score in a non-trending market.",
            "features": ["RSI_zscore", "bollinger_bandwidth", "stoch_k", "stoch_d", "market_mode"],
            "lookahead_range": [20, 70], "dd_range": [0.10, 0.25],
            "ideal_regime": ["Ranging", "Low Volatility"], "asset_class_suitability": ["Forex Majors", "Indices"], "ideal_macro_env": ["Any"]
        },
        "Meta_Labeling_Filter": {
            "description": "[SPECIALIZED] Uses a secondary ML filter to improve a simple primary model's signal quality.",
            "features": ["ADX", "RSI_slope", "ATR", "bollinger_bandwidth", "H1_ctx_Trend", "DAILY_ctx_Trend", "momentum_20", "relative_performance"],
            "lookahead_range": [50, 100], "dd_range": [0.1, 0.25],
            "requires_meta_labeling": True, "ideal_regime": ["Any"], "asset_class_suitability": ["Any"], "ideal_macro_env": ["Any"]
        },
        "MomentumCrossoverMA": {
            "description": "[HYBRID/TREND] A simple yet effective momentum strategy that uses a fast/slow moving average crossover (e.g., 9 EMA crossing 21 EMA) as a signal, but only takes the trade if a momentum indicator is also positive.",
            "features": ["EMA_20", "EMA_50", "momentum_10", "ADX"],
            "lookahead_range": [40, 100], "dd_range": [0.15, 0.25],
            "ideal_regime": ["Weak Trending", "Strong Trending"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Any"]
        },
        "MultiStructureBreakout": {
            "description": "[HYBRID/MARKET STRUCTURE] A high-conviction breakout strategy that requires a Break of Structure (BOS) on the base timeframe, confirmed by a trend context feature from a higher timeframe.",
            "features": ["bos_up_signal", "bos_down_signal", "volume_spike", "ATR", "DAILY_ctx_Trend"],
            "lookahead_range": [60, 150], "dd_range": [0.20, 0.35],
            "ideal_regime": ["Strong Trending"], "asset_class_suitability": ["Forex Majors", "Indices"], "ideal_macro_env": ["Risk-On", "Risk-Off"]
        },
        "NakedPriceAction": {
            "description": "[PRICE ACTION] A pure price action strategy that ignores most indicators, trading on engulfing/doji candles.",
            "features": ["is_engulfing", "is_doji", "wick_to_body_ratio", "DAILY_ctx_LinRegSlope", "hour", "day_of_week"],
            "lookahead_range": [40, 100], "dd_range": [0.15, 0.3],
            "ideal_regime": ["Any"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Any"]
        },
        "OscillatorMomentum": {
            "description": "[HYBRID/OSCILLATOR] An unconventional strategy that enters long when the RSI breaks out above a previous high (e.g., 65), suggesting that momentum is accelerating powerfully in the trend's direction.",
            "features": ["RSI", "RSI_slope_acceleration", "momentum_20", "ADX"],
            "lookahead_range": [50, 120], "dd_range": [0.20, 0.35],
            "ideal_regime": ["Strong Trending", "High Volatility"], "ideal_macro_env": ["Risk-On", "Risk-Off"], "asset_class_suitability": ["Any"]
        },
        "OvernightGapFade": {
            "description": "[HYBRID/INTRADAY] Fades significant overnight gaps with volume confirmation.",
            "features": ["overnight_gap_pct", "volume", "RSI", "ATR"],
            "lookahead_range": [20, 60], "dd_range": [0.2, 0.4],
            "ideal_regime": ["High Volatility"], "asset_class_suitability": ["Equities", "Indices"], "ideal_macro_env": ["Any"]
        },
        "PanicFade": {
            "description": "[CRISIS/EVENT-DRIVEN] A counter-trend strategy designed to fade extreme, news-driven price spikes or drops.",
            "features": ["anomaly_score", "ATR", "wick_to_body_ratio", "candle_body_size_vs_atr", "RSI", "market_volatility_index"],
            "lookahead_range": [20, 50], "dd_range": [0.25, 0.45],
            "ideal_regime": ["High Volatility"], "asset_class_suitability": ["Any"], "ideal_macro_env": ["Event-Driven", "Risk-Off"]
        },
        "PriceActionSwing": {
            "description": "[PRICE ACTION] Simple swing strategy based on higher highs/lower lows with confirmation from candle close.",
            "features": ["Close", "High", "Low", "ATR"],
            "lookahead_range": [50, 150], "dd_range": [0.2, 0.4],
            "ideal_regime": ["Weak Trending", "Strong Trending"], "asset_class_suitability": ["Any"], "ideal_macro_env": ["Any"]
        },
        "RSIDivergenceReversal": {
            "description": "[REVERSAL] A counter-trend strategy that enters when price action diverges from the RSI, signaling trend exhaustion.",
            "features": ["rsi_bullish_divergence", "rsi_bearish_divergence", "stoch_k", "ADX", "market_mode"],
            "lookahead_range": [30, 90], "dd_range": [0.15, 0.3],
            "ideal_regime": ["Ranging", "Weak Trending"], "asset_class_suitability": ["Any"], "ideal_macro_env": ["Neutral"]
        },
        "RSIMACDConfluence": {
            "description": "[HYBRID/OSCILLATOR] Requires both RSI and MACD to confirm signals in the same direction.",
            "features": ["RSI", "MACD_hist", "ADX"],
            "lookahead_range": [50, 120], "dd_range": [0.2, 0.35],
            "ideal_regime": ["Any"], "asset_class_suitability": ["Any"], "ideal_macro_env": ["Any"]
        },
        "RSIPullback": {
            "description": "[TRENDING] Enters on pullbacks in an uptrend, using RSI to identify oversold conditions.",
            "features": ["RSI", "SMA_50", "SMA_200"],
            "lookahead_range": [40, 120], "dd_range": [0.15, 0.3],
            "ideal_regime": ["Strong Trending", "Weak Trending"], "ideal_macro_env": ["Risk-On", "Risk-Off"], "asset_class_suitability": ["Indices", "Equities", "Forex Majors"]
        },
        "RSI_Stochastic_Confluence": {
            "description": "[HYBRID/OSCILLATOR] A mean-reversion strategy that requires both the RSI and the Stochastic oscillator to be in oversold/overbought territory simultaneously before triggering a trade.",
            "features": ["RSI", "stoch_k", "ADX", "bollinger_bandwidth"],
            "lookahead_range": [20, 60], "dd_range": [0.10, 0.20],
            "ideal_regime": ["Ranging", "Low Volatility"], "ideal_macro_env": ["Neutral"], "asset_class_suitability": ["Forex Crosses", "Indices"]
        },
        "RangeBound": {
            "description": "[RANGING] Trades reversals in a sideways channel, filtered by low ADX.",
            "features": ["ADX", "RSI", "stoch_k", "stoch_d", "bollinger_bandwidth", "hour", "wick_to_body_ratio"],
            "lookahead_range": [20, 60], "dd_range": [0.1, 0.2],
            "ideal_regime": ["Ranging", "Low Volatility"], "ideal_macro_env": ["Neutral"], "asset_class_suitability": ["Forex Crosses", "Forex Majors"]
        },
        "ReversalCandlestickMA": {
            "description": "[HYBRID/REVERSAL] Detects a reversal candlestick pattern (Doji with long wick) at a significant moving average (like the 200 EMA), providing a powerful confluence for a potential change in trend direction.",
            "features": ["is_doji", "wick_to_body_ratio", "EMA_200", "ADX"],
            "lookahead_range": [30, 80], "dd_range": [0.15, 0.30],
            "ideal_regime": ["Ranging", "Weak Trending"], "ideal_macro_env": ["Neutral"], "asset_class_suitability": ["Any"]
        },
        "ReversalPatternDivergence": {
            "description": "[HYBRID/REVERSAL] Identifies a swing failure/liquidity grab pattern and requires confirmation from MACD divergence, where the indicator fails to make a new high/low along with the price, signaling underlying weakness in the trend.",
            "features": ["liquidity_grab_up", "liquidity_grab_down", "MACD_hist", "volume", "ADX"],
            "lookahead_range": [70, 180], "dd_range": [0.20, 0.35],
            "ideal_regime": ["Strong Trending", "Weak Trending"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Forex Majors", "Indices", "Equities"]
        },
        "SeasonalCycleRSI": {
            "description": "[HYBRID/CYCLICAL] A speculative strategy that combines seasonal tendencies (month of year) with the RSI oscillator. It looks for buying opportunities during historically bullish months only if RSI is also in oversold territory (<30).",
            "features": ["month", "RSI", "market_volatility_index", "DAILY_ctx_Trend"],
            "lookahead_range": [28, 84], "dd_range": [0.20, 0.40],
            "ideal_regime": ["Any"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Indices", "Commodities"]
        },
        "SeasonalCycleVolatility": {
            "description": "[HYBRID/CYCLICAL] This strategy hypothesizes that certain times of day (e.g., London open) correlate with higher volatility. It enters a volatility breakout trade (break of Donchian channel) only during specific hours.",
            "features": ["hour", "donchian_channel", "ATR", "bollinger_bandwidth"],
            "lookahead_range": [20, 60], "dd_range": [0.25, 0.45],
            "ideal_regime": ["High Volatility", "Ranging"], "ideal_macro_env": ["Event-Driven"], "asset_class_suitability": ["Any"]
        },
        "SimpleMAChannel": {
            "description": "[TRENDING] Uses a channel created by two moving averages (20 and 50) with entries on pullbacks to the faster MA.",
            "features": ["EMA_20", "EMA_50", "RSI", "ATR"],
            "lookahead_range": [40, 120], "dd_range": [0.15, 0.3],
            "ideal_regime": ["Weak Trending", "Strong Trending"], "asset_class_suitability": ["Any"], "ideal_macro_env": ["Any"]
        },
        "SmoothedDynamicSR": {
            "description": "[HYBRID/PRICE ACTION] Combines the clarity of Heikin-Ashi charts with dynamic support and resistance (Bollinger Bands). A reversal of HA candle color at the bands triggers an entry.",
            "features": ["ha_color", "bollinger_upper", "bollinger_lower", "ATR"],
            "lookahead_range": [60, 150], "dd_range": [0.10, 0.20],
            "ideal_regime": ["Ranging", "Weak Trending"], "ideal_macro_env": ["Neutral"], "asset_class_suitability": ["Forex Majors", "Indices"]
        },
        "SmoothedMACDCrossover": {
            "description": "[HYBRID/TREND] Uses Heikin-Ashi charts to filter out market noise and enters on a clear MACD crossover. The signal is only taken after a sequence of at least two same-colored HA bricks, confirming the trend direction.",
            "features": ["ha_color", "ha_streak", "MACD_line", "MACD_signal", "ADX"],
            "lookahead_range": [80, 200], "dd_range": [0.15, 0.25],
            "ideal_regime": ["Strong Trending"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Indices", "Equities"]
        },
        "StanWeinsteinBreakout": {
            "description": "[BREAKOUT] A long-term trend-following strategy that enters on breakouts from consolidation, confirmed by volume.",
            "features": ["SMA_30_weekly", "volume", "relative_strength"],
            "lookahead_range": [100, 200], "dd_range": [0.2, 0.4],
            "ideal_regime": ["Strong Trending"], "ideal_macro_env": ["Risk-On"], "asset_class_suitability": ["Equities", "Indices"]
        },
        "StochasticScalp": {
            "description": "[SCALPING] A high-frequency strategy using the Stochastic for overbought/oversold entry signals confirmed by short-term EMA trend.",
            "features": ["stoch_k", "stoch_d", "EMA_20", "MACD_hist_slope", "candle_body_to_range_ratio"],
            "lookahead_range": [10, 40], "dd_range": [0.05, 0.20],
            "ideal_regime": ["Weak Trending", "Strong Trending"], "asset_class_suitability": ["Forex Majors", "Indices"], "ideal_macro_env": ["Any"]
        },
        "StructureSwingFailure": {
            "description": "[HYBRID/MARKET STRUCTURE] A reversal strategy that looks for a failure to create a new higher high or lower low (a liquidity grab). It enters on the subsequent break of the *previous* market structure point (CHoCH), confirmed by a spike in volume.",
            "features": ["liquidity_grab_up", "liquidity_grab_down", "choch_up_signal", "choch_down_signal", "volume", "MACD_hist"],
            "lookahead_range": [50, 140], "dd_range": [0.20, 0.30],
            "ideal_regime": ["Any"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Any"]
        },
        "SupportResistanceRSI": {
            "description": "[HYBRID/SR] Combines support/resistance levels with RSI confirmation for entries.",
            "features": ["support_level_20", "resistance_level_20", "RSI", "ADX"],
            "lookahead_range": [40, 120], "dd_range": [0.15, 0.3],
            "ideal_regime": ["Ranging", "Weak Trending"], "asset_class_suitability": ["Any"], "ideal_macro_env": ["Neutral"]
        },
        "TrendFilterScalper": {
            "description": "[HYBRID/SCALPING] Uses higher timeframe trend as filter for intraday scalping signals.",
            "features": ["EMA_20", "DAILY_ctx_Trend", "stoch_k", "ATR"],
            "lookahead_range": [10, 30], "dd_range": [0.05, 0.15],
            "ideal_regime": ["Weak Trending", "Strong Trending"], "asset_class_suitability": ["Forex Majors", "Indices"], "ideal_macro_env": ["Any"]
        },
        "TrendPullback": {
            "description": "[TRENDING] Enters on pullbacks during a confirmed trend, using market structure and statistical momentum.",
            "features": ["bos_up_signal", "bos_down_signal", "market_mode", "RSI_zscore", "DAILY_ctx_Trend"],
            "lookahead_range": [50, 150], "dd_range": [0.15, 0.3],
            "ideal_regime": ["Strong Trending", "Weak Trending"], "asset_class_suitability": ["Forex Majors", "Indices", "Commodities"], "ideal_macro_env": ["Risk-On", "Risk-Off"]
        },
        "VWAPMomentum": {
            "description": "[TRENDING/INTRADAY] A trend-following strategy that uses VWAP as a dynamic filter. Enters on pullbacks to a rising VWAP.",
            "features": ["vwap_slope", "price_vs_vwap_sign", "DAILY_ctx_LinRegSlope", "ADX", "momentum_10_slope_acceleration", "volume"],
            "lookahead_range": [40, 120], "dd_range": [0.15, 0.3],
            "ideal_regime": ["Weak Trending", "Strong Trending"], "ideal_macro_env": ["Neutral", "Risk-On"], "asset_class_suitability": ["Indices", "Equities"]
        },
        "VWAPReversion": {
            "description": "[RANGING/INTRADAY] A classic mean-reversion strategy that enters when the price deviates significantly from the daily VWAP.",
            "features": ["price_to_vwap", "ADX", "RSI", "bollinger_bandwidth", "hour", "DAILY_ctx_Trend"],
            "lookahead_range": [20, 60], "dd_range": [0.1, 0.2],
            "ideal_regime": ["Ranging"], "ideal_macro_env": ["Neutral"], "asset_class_suitability": ["Indices", "Equities"]
        },
        "VWAP_Crossover": {
            "description": "[HYBRID/VOLUME] A volume-based trend strategy that uses a price crossover of the daily VWAP. A crossover is confirmed by an increase in volume, validating the signal.",
            "features": ["price_vs_vwap_sign", "volume", "ADX", "vwap_slope"],
            "lookahead_range": [50, 130], "dd_range": [0.15, 0.30],
            "ideal_regime": ["Weak Trending", "Strong Trending"], "ideal_macro_env": ["Any"], "asset_class_suitability": ["Equities", "Indices"]
        },
        "VolatilityAdjustedMA": {
            "description": "[HYBRID/VOLATILITY] Adjusts moving average entries based on current volatility regime.",
            "features": ["EMA_50", "ATR", "bollinger_bandwidth", "market_volatility_index"],
            "lookahead_range": [50, 150], "dd_range": [0.15, 0.3],
            "ideal_regime": ["Any"], "asset_class_suitability": ["Any"], "ideal_macro_env": ["Any"]
        },
        "VolatilityExpansionBreakout": {
            "description": "[BREAKOUT] Enters on strong breakouts that occur after a period of low-volatility consolidation (Bollinger Squeeze).",
            "features": ["bollinger_bandwidth", "bollinger_squeeze", "ATR", "market_volatility_index", "DAILY_ctx_Trend"],
            "lookahead_range": [70, 140], "dd_range": [0.2, 0.4],
            "ideal_regime": ["Low Volatility", "High Volatility"], "asset_class_suitability": ["Any"], "ideal_macro_env": ["Event-Driven", "Neutral"]
        },
        "VolumeBreakout": {
            "description": "[BREAKOUT] Capitalizes on price breaking through established support or resistance, confirmed by a significant volume spike.",
            "features": ["support_level_20", "resistance_level_20", "volume_spike", "ATR", "ADX"],
            "lookahead_range": [40, 120], "dd_range": [0.20, 0.40],
            "ideal_regime": ["High Volatility", "Strong Trending"], "asset_class_suitability": ["Equities", "Indices", "Crypto"], "ideal_macro_env": ["Any"]
        }
    }

    if not os.path.exists(playbook_path):
        logger.warning(f"'strategy_playbook.json' not found. Seeding a new one with default strategies at: {playbook_path}")
        try:
            with open(playbook_path, 'w') as f:
                json.dump(DEFAULT_PLAYBOOK, f, indent=4)
            return DEFAULT_PLAYBOOK
        except IOError as e:
            logger.error(f"Failed to create playbook file: {e}. Using in-memory default.")
            return DEFAULT_PLAYBOOK
            
    try:
        with open(playbook_path, 'r') as f:
            playbook = json.load(f)

        missing_keys = [k for k in DEFAULT_PLAYBOOK if k not in playbook]
        if missing_keys:
            logger.info(f"Updating playbook with {len(missing_keys)} new default strategies...")
            for k in missing_keys:
                playbook[k] = DEFAULT_PLAYBOOK[k]
            with open(playbook_path, 'w') as f:
                json.dump(playbook, f, indent=4)

        logger.info(f"Successfully loaded and verified dynamic playbook from {playbook_path}")
        return playbook
    except (json.JSONDecodeError, IOError) as e:
        logger.error(f"Failed to load or parse playbook file: {e}. Using in-memory default.")
        return DEFAULT_PLAYBOOK