Tune EUR/USD trade setup: quality-scaled TP and tighter SL
EUR/USD A-grade signals had inverted quality curve (-1.65R) because all trades got RR≈0.50 and mature_move logic penalized high-score entries. Fix: add per-pair trade setup params (sl_atr_floor=1.2, min_rr=1.0, mature_move_threshold=35) and apply quality_scale to both tp_mult and min_rr so A-grade gets wider TP targets. Also wire EUR config into backtest via PAIR_PRODUCERS registry. Result: A-grade now +1.24R (was -1.65R), total EUR/USD +10.06R (was +4.20R). XAU/USD unchanged at +13.01R. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+23
@@ -1676,6 +1676,12 @@ def _():
|
||||
assert 5 not in cfg.allowed_weekdays # No Saturday
|
||||
assert 6 not in cfg.allowed_weekdays # No Sunday
|
||||
assert cfg.min_atr_threshold == 0.0003
|
||||
assert cfg.sl_atr_floor == 1.2
|
||||
assert cfg.min_rr_ratio == 1.0
|
||||
assert cfg.mature_move_threshold == 35.0
|
||||
assert cfg.tp_quality_scale["A+"] == 1.8
|
||||
assert cfg.tp_quality_scale["A"] == 1.2
|
||||
assert cfg.tp_quality_scale["C"] == 1.0
|
||||
|
||||
|
||||
@test("PlatformConfig has eur_strategy field")
|
||||
@@ -1758,6 +1764,23 @@ def _():
|
||||
assert "EUR/USD" not in NewsEngine._get_affected_pairs("GBP")
|
||||
|
||||
|
||||
@test("EUR/USD trade setup uses quality-scaled TP and tighter SL")
|
||||
def _():
|
||||
from pair_signals.eurusd import make_config
|
||||
from signal_aggregator import SignalAggregator
|
||||
config = make_config(Timeframe.H1)
|
||||
config.backtest.session_filter = False
|
||||
assert config.eur_strategy.sl_atr_floor == 1.2
|
||||
assert config.eur_strategy.min_rr_ratio == 1.0
|
||||
assert config.eur_strategy.tp_quality_scale["A"] == 1.2
|
||||
agg = SignalAggregator(config)
|
||||
df = make_ohlcv(n=300, start_price=1.0800, trend=0.0003, seed=77)
|
||||
dfs = {Timeframe.H1: df, Timeframe.M15: df, Timeframe.H4: df}
|
||||
report = agg.analyze_from_dataframes(symbol=EURUSD, dfs=dfs, use_news=False)
|
||||
if report.trade_setup:
|
||||
assert report.trade_setup.risk_reward >= 1.0 - 0.01
|
||||
|
||||
|
||||
# ══════════════════════════════════════════════════════════════════════
|
||||
# SUMMARY
|
||||
# ══════════════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in New Issue
Block a user