"""XAU/USD signal producer config. PlatformConfig defaults ARE the tuned XAU/USD configuration, so this factory sets the timeframes plus documented per-timeframe overrides. It must stay equivalent to the inline PlatformConfig(symbol=XAUUSD, ...) construction (plus those overrides) used by the backtester and Telegram bot (enforced by a test in test_all.py). M15 override (validated 2026-07-11, window 2025-03-30 -> 2026-05-31, $0.30 spread, trailing exits): tp_floor_rr 1.0 scores +116.6R/460 trades PF 1.83 vs +105.4R/424 PF 1.82 at the 0.5 default — better in both train/val halves and on the 2024-06 -> 2025-03 out-of-sample window (+30.3R vs +10.6R; the 1R floor lifts targets past the min-TP spread gate, roughly doubling trades there). The same knob HURTS M5 (pinned 12mo book: +131.3R/699 vs +139.9R/547, PF 1.55 vs 1.78), so it is per-timeframe, exactly as PENDING_STEPS' decision rule anticipated. """ from typing import Optional, List from config import PlatformConfig, Timeframe _CONFIRMATIONS = { Timeframe.M5: [Timeframe.M15, Timeframe.H1], Timeframe.M15: [Timeframe.M5, Timeframe.H1], Timeframe.H1: [Timeframe.M15, Timeframe.H4], Timeframe.H4: [Timeframe.H1, Timeframe.D1], } def make_config( primary_tf: Timeframe, confirmation_tfs: Optional[List[Timeframe]] = None, ) -> PlatformConfig: config = PlatformConfig() config.primary_timeframe = primary_tf config.confirmation_timeframes = ( confirmation_tfs or _CONFIRMATIONS.get(primary_tf, [Timeframe.M15, Timeframe.H4]) ) if primary_tf == Timeframe.M15: # 1R minimum target on M15 only — see module docstring. config.signals.tp_floor_rr = 1.0 return config