diff --git a/telegram_bot.py b/telegram_bot.py index efb6641..c2f28b4 100644 --- a/telegram_bot.py +++ b/telegram_bot.py @@ -40,22 +40,24 @@ logger = logging.getLogger(__name__) # ── Config ────────────────────────────────────────────────────────── -SCAN_TIMEFRAMES = ["M15", "H1", "H4", "D1"] +SCAN_TIMEFRAMES = ["M15", "H1", "D1", "W1"] _TF_MAP = { "M5": Timeframe.M5, "M15": Timeframe.M15, "M30": Timeframe.M30, "H1": Timeframe.H1, "H4": Timeframe.H4, "D1": Timeframe.D1, + "W1": Timeframe.W1, } _TF_CONFIRMATIONS = { - "M15": [Timeframe.M5, Timeframe.H1], - "H1": [Timeframe.M15, Timeframe.H4], - "H4": [Timeframe.H1, Timeframe.D1], - "D1": [Timeframe.H4, Timeframe.W1], + "M15": [Timeframe.H1, Timeframe.D1], + "H1": [Timeframe.M15, Timeframe.D1], + "D1": [Timeframe.H1, Timeframe.W1], + "W1": [Timeframe.D1], } _GRADE_RANK = {"A+": 0, "A": 1, "B": 2, "C": 3, "D": 4, "F": 5} +_GRADE_LEGEND = "Grade scale: 🔥 A+ · ✅ A · 👍 B · ⚠️ C · 📉 D · ❌ F" _EST = ZoneInfo("America/New_York") # ── Formatting helpers ────────────────────────────────────────────── @@ -75,6 +77,10 @@ def _signal_action(signal: SignalStrength) -> str: }.get(signal, "NEUTRAL") +def _grade_symbol(quality: str) -> str: + return {"A+": "🔥", "A": "✅", "B": "👍", "C": "⚠️", "D": "📉"}.get(quality, "❌") + + def _indicator_condition(ind) -> str: desc = ind.description if " — " in desc: @@ -114,8 +120,9 @@ def _build_combined_signal( MTF detail block (folded to one line), news unless non-neutral. """ lines: List[str] = [] - lines.append(f"🌐 {_h(display)} — Signal Analysis") + lines.append(f"🌐 🧠 {_h(display)} — Signal Analysis") lines.append(f"🕐 {now_str}") + lines.append(f"{_GRADE_LEGEND}") for tf in SCAN_TIMEFRAMES: reports = results_by_tf.get(tf, []) @@ -137,10 +144,11 @@ def _build_combined_signal( continue action = _signal_action(r.final_signal) + sym = _grade_symbol(r.signal_quality) lines.append("") lines.append("────────────────────────") - lines.append(f"{tf} · {action} · Grade {_h(r.signal_quality)}") + lines.append(f"{sym} {tf} · {action} · Grade {_h(r.signal_quality)}") lines.append("") # ── Trade setup (always kept intact) ───────────────────────── @@ -207,15 +215,17 @@ def _build_scan_message( Full entry/TP/SL preserved; no indicator list (use /signal to drill in). """ lines: List[str] = [] - lines.append(f"📊 Scan Complete · {now_str}") + lines.append(f"📊 🧠 Scan Complete · {now_str}") lines.append(f"Timeframes: {_h(tfs_str)} | Best signal per pair") + lines.append(f"{_GRADE_LEGEND}") lines.append("") for tf, r in actionable: action = _signal_action(r.final_signal) + sym = _grade_symbol(r.signal_quality) lines.append( - f"{_h(r.display_name)} · {action}" + f"{sym} {_h(r.display_name)} · {action}" f" · {_h(r.signal_quality)} · {tf}" ) @@ -325,9 +335,12 @@ class ForexTelegramBot: " /help — This message\n\n" f"Timeframes analyzed: {tfs}\n\n" "Signal Grades:\n" - " A / A+ — High confidence, consider entry\n" - " B — Decent setup, wait for confirmation\n" - " C / D — Low confidence, watch only\n\n" + " 🔥 A+ — Strongest signal, MTF aligned, high confidence\n" + " ✅ A — Strong signal, MTF aligned\n" + " 👍 B — Decent setup, wait for confirmation\n" + " ⚠️ C — Weak signal, watch only\n" + " 📉 D — Very weak, no action\n" + " ❌ F — No clear signal\n\n" "⚠️ Educational use only. Not financial advice." ) await update.message.reply_text(text, parse_mode=ParseMode.HTML)