mirror of
https://github.com/lucasmos/GoldRegime_X.git
synced 2026-11-02 06:26:15 +00:00
fix: clearer no-signal reason + cp1252 unicode crash in logger
- mt5_trader: replace generic "No signal (need >X or <Y)" with an explicit reason that names the actual block — regime mismatch vs probability not cleared (e.g. "Bear state but prob=0.521 not <0.480") so users can see at a glance whether the HMM or XGBoost gated the bar - main: replace U+2192 arrow in migration log message with ASCII '->' to avoid UnicodeEncodeError on Windows cp1252 terminals Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
3e566301f1
commit
5b2a5ccefd
@@ -58,7 +58,7 @@ def _check_m5_readiness(tf: str, broker: str = "headway_cent") -> bool:
|
||||
_legacy = Path("models/m5_meta.json")
|
||||
if _legacy.exists():
|
||||
logger.info(
|
||||
"Migrating legacy m5_meta.json → %s for broker=%s.", meta_path, broker
|
||||
"Migrating legacy m5_meta.json -> %s for broker=%s.", meta_path, broker
|
||||
)
|
||||
meta_path.write_text(_legacy.read_text())
|
||||
else:
|
||||
|
||||
+8
-4
@@ -844,10 +844,14 @@ def _run_loop_inner(tf: str, broker: str, account_size: float, mt5,
|
||||
direction = "SELL"
|
||||
order_type = mt5.ORDER_TYPE_SELL
|
||||
else:
|
||||
logger.info(
|
||||
"No signal (prob=%.3f state=%s need >%.3f or <%.3f).",
|
||||
prob, state_lbl, prob_threshold, short_threshold,
|
||||
)
|
||||
# Explain exactly why no signal fired
|
||||
if hmm_state == BULL_STATE:
|
||||
reason = f"Bull state but prob={prob:.3f} not >{prob_threshold:.3f}"
|
||||
elif hmm_state == BEAR_STATE:
|
||||
reason = f"Bear state but prob={prob:.3f} not <{short_threshold:.3f}"
|
||||
else:
|
||||
reason = f"Chop state — no signal regardless of prob"
|
||||
logger.info("No signal (%s).", reason)
|
||||
time.sleep(POLL_INTERVAL_SEC)
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user