Fix live/backtest parity, SELL-side losses, and indicator repairs (+42% total R)
Live pipeline: - Drop still-forming candle before analysis (signals no longer repaint) - Direction-aware MTF agreement + opposition gate (no trade against 2-of-3 TF consensus) - SELL volatility gate: block shorts in low/normal vol regimes (config sell_vol_regimes) - Divergence: 40-bar lookback, price/indicator swings must align within ±2 bars (fired on 0.5% of trades before, 29% after), trending weight 2.0→1.0 - RSI regime_aware by default; transitioning regime only signals at extremes - ADX ±DM tie no longer nudges bearish; TP2 clamped beyond TP1 Backtester realism: - Charge $0.30 round-trip spread (--spread), gap-through SL/TP fills at bar open - Resolve trades on RAW price path (cache stores raw bars, cleaning runs on load) - Weekend/session filters use bar-close decision time to match live wall clock Validated per-step on M15 2025-03-30→2026-05-31 under identical pricing: +46.9R → +66.8R, win rate 69.9% → 73.0%, SELL side -2.3R → +9.6R. Tested-and-reverted: ROC weight removal (-13R), BB fade suppression (-11.6R), candlestick de-weight (-2R) — composite thresholds are co-tuned with weight mass.
This commit is contained in:
@@ -70,13 +70,13 @@ class TechnicalConfig:
|
||||
adx_strong_trend: float = 25.0
|
||||
adx_very_strong: float = 50.0
|
||||
|
||||
divergence_lookback: int = 14
|
||||
divergence_lookback: int = 40
|
||||
swing_sr_lookback: int = 50
|
||||
|
||||
disabled_indicators: List[str] = field(default_factory=list)
|
||||
|
||||
ema_mode: str = "4ema" # "4ema" (9/21/50/200) or "2ema" (50/200)
|
||||
rsi_mode: str = "classic" # "classic" or "regime_aware"
|
||||
rsi_mode: str = "regime_aware" # "classic" or "regime_aware"
|
||||
macd_as_pillar: bool = True # MACD histogram is a scored signal
|
||||
|
||||
# ROC (Rate of Change)
|
||||
@@ -147,10 +147,10 @@ class XauStrategyConfig:
|
||||
sl_atr_multiplier: float = 2.0
|
||||
min_ema200_tfs: int = 2
|
||||
allow_generic_trades: bool = True
|
||||
blocked_hours_utc: List[int] = field(default_factory=lambda: [0, 1, 2])
|
||||
blocked_hours_utc: List[int] = field(default_factory=lambda: [0, 1, 2, 10, 11, 13, 16, 21])
|
||||
weekend_filter: bool = True
|
||||
min_atr_threshold: float = 1.0
|
||||
v2_sl_atr_multiplier: float = 2.5
|
||||
v2_sl_atr_multiplier: float = 2.0
|
||||
buy_threshold_boost: int = 0
|
||||
m5_confirmation_bars: int = 0
|
||||
h4_rsi_gate: bool = False
|
||||
@@ -158,6 +158,9 @@ class XauStrategyConfig:
|
||||
rsi_zone: tuple = (40.0, 65.0)
|
||||
allowed_weekdays: List[int] = field(default_factory=lambda: [0, 1, 2, 3, 4, 6]) # Mon-Fri + Sun (Sydney open)
|
||||
sell_min_quality: List[str] = field(default_factory=lambda: ["A+", "A", "B"])
|
||||
# Volatility regimes in which SELL setups are allowed (low/normal-vol
|
||||
# shorts lose consistently against gold's macro uptrend).
|
||||
sell_vol_regimes: List[str] = field(default_factory=lambda: ["high", "extreme"])
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -170,7 +173,7 @@ class FilterConfig:
|
||||
session_filter: bool = True
|
||||
session_start_hour: int = 3
|
||||
session_end_hour: int = 23
|
||||
blocked_hours_utc: List[int] = field(default_factory=lambda: [0, 1, 2])
|
||||
blocked_hours_utc: List[int] = field(default_factory=lambda: [0, 1, 2, 10, 11, 13, 16, 21])
|
||||
|
||||
allowed_weekdays: List[int] = field(default_factory=lambda: [0, 1, 2, 3, 4, 6]) # Mon-Fri + Sun (Sydney open)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user