Version 2.660 2026.03.13
//| Version: 2.66 |
//| |
//| Changelog: |
//| v2.66 - Telegram 429 Rate-Limit protection: ParseRetryAfter() |
//| reads retry_after from response, SendRawToChannel |
//| retries up to 3x with wait+3s buffer; preventive |
//| 2500ms pause between recipients in SendDual and |
//| SendDualGetMsgId; #property strict removed; link |
//| updated to seller profile |
//| |
Version 2.650 2026.03.10
//| Version: 2.65 |
//| |
//| Changelog: |
//| v2.65 - EOD and stündlicher Status Report getrennt: neuer |
//| GetEODReport() mit Net P/L+Swap+Comm+Float+Combined, |
//| kein Trade-Listing; GetClosedPositionsReport() bleibt |
//| Gross-only für Status Report, Header → Closing Report |
//| |
Version 2.640 2026.03.10
//| Version: 2.64 |
//| |
//| Changelog: |
//| v2.64 - EOD report always shows float P&L of all open |
//| positions (Closed P&L + Float + Combined), consistent |
//| with weekly/monthly auto reports; header hint added |
//| |
Version 2.630 2026.03.10
//| Version: 2.63 |
//| |
//| Changelog: |
//| v2.63 - MarkPositionAsReported log moved to Level 3 (trace); |
//| message clarified: normal for already-reported closes |
//| |
//| v2.62 - Auto Weekly/Monthly reports: net P/L now includes |
//| entry commission (HistorySelectByPosition), float of |
//| ALL open positions added, header shows what is |
//| included (closed net + swap/comm + float open) |
//| |
//| v2.61 - Fix: partial close of pre-existing positions now |
//| correctly reported; volume record initialized with |
//| reported=false instead of age-based suppression |
//| |
Version 2.600 2026.03.10
//| Version: 2.60 |
//| |
//| Changelog: |
//| v2.60 - Fix: partial close of pre-existing positions now |
//| correctly reported; volume record initialized with |
//| reported=false instead of age-based suppression |
//| |
Version 2.590 2026.03.10
//| Version: 2.59 |
//| |
//| Changelog: |
//| v2.59 - Status report now shows pre-restart close recoveries |
//| via m_preexisting_recovered counter; only shown when |
//| > 0 as "Pre-restart closes recovered: N 🔄" |
//| |
Version 2.580 2026.03.10
//| Version: 2.58 |
//| |
//| Changelog: |
//| v2.58 - Fix: pre-existing positions (open before EA restart) |
//| now correctly trigger close report; root cause was |
//| AddPositionToReportedList() called for positions older |
//| than 600s/batch_time_threshold, which blocked the |
//| close path via IsPositionAlreadyReported(); fix: |
//| use only m_tracker.MarkPositionAsReported() so open- |
//| report is suppressed but close-report still fires; |
//| AddClosedPosition fallback reconstruction also kept |
//| as safety net; m_missed_reports counter now accurate |
//| |
//| v2.57 - Fix: positions open before EA restart now correctly |
//| report their close; AddClosedPosition previously |
//| returned silently when position not in m_positions[]; |
//| now reconstructs from deal history and reports anyway |
//| |
Version 2.560 2026.03.09
//| Version: 2.56 |
//| |
//| Changelog: |
//| v2.56 - Correct net P/L for split-commission brokers: |
//| for each EXIT deal, HistorySelectByPosition fetches |
//| the matching ENTRY deal to add its COMMISSION+SWAP; |
//| HistorySelect restored after each lookup; affected: |
//| cmd_today, cmd_weekly, cmd_monthly, cmd_perf; |
//| matches MT5 History total exactly |
//| |
Version 2.550 2026.03.09
//| Version: 2.55 |
//| |
//| Changelog: |
//| v2.55 - Reverted v2.50/v2.51 commission fix: all P/L commands |
//| now use EXIT deals only with PROFIT+SWAP+COMMISSION; |
//| matches MT5 history display exactly; affected: |
//| cmd_today, cmd_weekly, cmd_monthly, cmd_perf; |
//| Status/Health daily/weekly/monthly unchanged |
//| |
Version 2.540 2026.03.09
//| Version: 2.54 |
//| |
//| Changelog: |
//| v2.54 - All position-based follower commands extended to max |
//| 10 positions with (max 10) header hint: |
//| cmd_open 5→10, cmd_live 8→10, cmd_sltp 6→10, |
//| cmd_be all→10; overflow hint updated accordingly; |
//| #property version updated to 2.54 |
//| |
Version 2.530 2026.03.09
//| Version: 2.53 |
//| |
//| Changelog: |
//| v2.53 - cmd_closed header now shows (last 10) hint; |
//| #property version updated to 2.53 |
//| |
//| v2.52 - cmd_closed (Closed Today) now shows DEAL_PROFIT only |
//| (no swap/commission) — matches MT5 history display; |
//| #property version updated to 2.52 |
//| |
//| v2.51 - cmd_perf and cmd_weekly commission split fix: entry |
//| deal commission now included (same as v2.50 fix for |
//| cmd_today/monthly); cmd_risk: account info block now |
//| hidden when SendAccountInfo=false (shows ⛔ message); |
//| cmd_risk: Net Exposure added below Total Exposure — |
//| absolute difference of buy vs sell lots per symbol, |
//| shows ⚖️ fully hedged when net is 0.00; |
//| #property version updated to 2.51 |
//| |
//| v2.50 - cmd_today and cmd_monthly commission fix: brokers split |
//| commission across entry and exit deals; previous code |
//| only collected commission from DEAL_ENTRY_OUT → half |
//| commission was missing; now DEAL_PROFIT+DEAL_SWAP from |
//| exit deals only, DEAL_COMMISSION from all deals; |
//| result now matches MT5 History totals exactly; |
//| #property version updated to 2.50 |
//| |
Version 2.490 2026.03.09
//| Version: 2.49 |
//| |
//| Changelog: |
//| v2.49 - FormatClosedLiveMessage P/L now consistently shows |
//| gross profit only (DEAL_PROFIT, no swap/commission); |
//| UpdateLivePositions history lookup previously added |
//| swap+commission causing inconsistency vs batch path |
//| which used m_closed[].profit = DEAL_PROFIT only; |
//| #property version updated to 2.49 |
//| |
Version 2.480 2026.03.09
//| Changelog: |
//| v2.48 - ReportSinglePosition() split into two sends: full |
//| Trade-Open report (with account info) goes to ChatID |
//| only via SendTelegramMessageSafe; compact |
//| FormatLiveMessage goes to Live Topic only via |
//| SendLiveOnly — Live Topic no longer shows full report |
//| briefly before being edited to compact format; |
//| #property version updated to 2.48 |
//| |
Version 2.470 2026.03.09
//| Version: 2.47 |
//| |
//| Changelog: |
//| v2.47 - Live streaming messages no longer duplicated to |
//| classic ChatID: new SendLiveOnly() method sends only |
//| to Live Topic; Seed and Reseed FormatLiveMessage calls |
//| now use SendLiveOnly(); Trade-Open report (full format |
//| with account info) still uses SendDualGetMsgId as it |
//| belongs in both channels; |
//| #property version updated to 2.47 |
//| |
Version 2.460 2026.03.09
//| Version: 2.46 |
//| |
//| Changelog: |
//| v2.46 - ClosedPositionData.type now correctly stored from |
//| m_positions[].type (original position direction); |
//| deal-based type derivation was always inverted — |
//| BUY exit deal closes SELL position but was stored as |
//| POSITION_TYPE_BUY causing BUY shown for SELL closes; |
//| FormatClosedLiveMessage inversion removed (no longer |
//| needed); UpdateLivePositions history lookup corrected |
//| to invert deal type for proper direction; |
//| #property version updated to 2.46 |
//| |
Version 2.450 2026.03.09
//| Version: 2.45 |
//| |
//| Changelog: |
//| v2.45 - UpdateLivePositions() race condition fix improved: |
//| when timer detects closed position, EA now looks up |
//| exit deal in HistorySelectByPosition to build proper |
//| FormatClosedLiveMessage (Entry, Closed price, pts, |
//| P/L, Reason, Hold, ✅/❌ CLOSED footer); fallback to |
//| footer-only StringReplace if no history found; |
//| last_text field in LiveMsgEntry retained as fallback; |
//| #property version updated to 2.45 |
//| |
//| v2.44 - UpdateLivePositions() now handles race condition where |
//| timer tick detects closed position before batch |
//| processor runs: LiveMsgEntry extended with last_text |
//| field — last FormatLiveMessage output stored on each |
//| update; on stale detection: LIVE footer replaced with |
//| ❌ CLOSED footer via StringReplace, message edited, |
//| then entry removed — prevents live messages staying |
//| as 📡 LIVE indefinitely after position closes; |
//| #property version updated to 2.44 |
//| |
Version 2.430 2026.03.09
//| Version: 2.43 |
//| |
//| Changelog: |
//| v2.43 - FormatClosedLiveMessage direction bug fixed: closed.type|
//| is stored as exit deal type (DEAL_TYPE_BUY closes SELL |
//| position) — FormatClosedLiveMessage now inverts type |
//| to recover original position direction; existing closed |
//| reports (FormatClosedPositionData) already handled this |
//| correctly; pts calculation also corrected for direction;|
//| #property version updated to 2.43 |
//| |
Version 2.420 2026.03.08
//| Version: 2.42 |
//| |
//| Changelog: |
//| v2.42 - Live Topic on close: live streaming message now edited |
//| to compact CLOSED state (FormatClosedLiveMessage): |
//| Entry, Closed price (+pts), P/L, Lots, Reason, Hold, |
//| ✅/❌ CLOSED footer with close time; previously the |
//| full close report was sent to Live Topic — now only |
//| open positions remain visible there; if no live msg |
//| tracked (no msg_id), nothing is posted to Live Topic; |
//| full close report continues to go to classic ChatID; |
//| #property version updated to 2.42 |
//| |
Version 2.410 2026.03.08
//| Version: 2.41 |
//| |
//| Changelog: |
//| v2.41 - CPositionTracker destructor now calls ArrayFree on |
//| m_positions[] and m_closed[]; CTelegramPositionRe- |
//| porter destructor now calls ArrayFree on |
//| m_message_queue[], m_reported_tickets[], |
//| m_reported_timestamps[] — eliminates "leaked strings" |
//| and "leaked memory" warnings in MT5 Journal on |
//| EA shutdown; no functional change; |
//| #property version updated to 2.41 |
//| |
//| v2.40 - SendAccountInfo=false now consistently respected: |
//| cmd_account (Follower menu) returns "⛔ Account info |
//| not available." instead of exposing balance/equity; |
//| cmd_uptime omits account number line when false; |
//| ShowField_Comment input comment corrected to |
//| "Show trade comment field"; |
//| #property version updated to 2.40 |
//| |
Version 2.390 2026.03.08
//| Version: 2.39 |
//| |
//| Changelog: |
//| v2.39 - GetOpenPositions() now respects m_show_comment flag: |
//| Comment line only shown when ShowField_Comment=true |
//| and comment is non-empty (no more "—" placeholder); |
//| Partial-Close report same fix applied; previously |
//| both ignored ShowField_Comment entirely; |
//| #property version updated to 2.39 |
//| |
//| v2.38 - GetClosureReason() expanded: Stop Loss, Take Profit, |
//| Close By, Other — DEAL_REASON_CLOSE_BY now returns |
//| "Close By" instead of "Other"; inline switch in |
//| GetClosedPositionsReport() updated to match; |
//| #property version updated to 2.38 |
//| |
//| v2.37 - GetClosedPositionsReport() now uses DEAL_REASON for |
//| reason label (Stop Loss / Take Profit / Other) instead |
//| of comment-string parsing via CloseReasonLabel(); |
//| comment fallback only used when DEAL_REASON = Other; |
//| #property version updated to 2.37 |
//| |
//| v2.36 - GetClosureReason() simplified to Stop Loss / Take |
//| Profit / Other — Manual, Expert Advisor, Stop Out, |
//| Opposite position all collapse to "Other" for cleaner |
//| follower-facing reports; #property version updated |
//| to 2.36 |
//| |
//| v2.35 - SendAutoReports parameter added: controls automatic |
//| EOD/Weekly/Monthly P&L reports independently from |
//| SendClosedPositionsReport (which now only controls |
//| closed P/L in hourly status reports); previously all |
//| three auto-reports were coupled to |
//| SendClosedPositionsReport — now fully decoupled; |
//| DEAL_REASON_SO added to GetClosureReason(): |
//| Margin Call / Stop Out now shown as "Stop Out" instead |
//| of "Other"; CloseReasonLabel() comment-based fallback |
//| now only shown in compact format when DEAL_REASON |
//| returns "Other" — eliminates redundant labels like |
//| "[Stop Loss] SL" in batch and cmd_closed reports; |
//| #property version and all version strings updated to |
//| 2.35 |
//| |
Version 2.343 2026.03.08
//| Version: 2.34 |
//| |
//| Changelog: |
//| v2.343 - Automatic P&L Reports (DailyChannelID topic renamed |
//| "P&L Reports"): EOD daily report at 23:59, weekly |
//| every Friday 22:00, monthly on last day of month |
//| 22:00 — all via SendDual to ChatID + DailyChannelID; |
//| full stats: total P&L, trade count W/L, win rate, |
//| avg win/loss, profit factor, best/worst trade with |
//| symbol; three smart cases: full stats / float P&L / |
//| quiet confirmation; all coupled to |
//| SendClosedPositionsReport flag; GetWeeklyReport() and |
//| GetMonthlyReport() also available on demand; |
//| Live message seeding on startup: open positions |
//| without tracked msg_id get fresh live message sent |
//| immediately to LiveChannelID on EA init; |
//| FormatOfflineMessage: all tracked live messages edited |
//| to "⏸ EA OFFLINE" state on deinit, auto-resumed on |
//| next restart via stored msg_ids; |
//| Live message layout: SL/TP now on separate lines; |
//| 📡 replaces 🔴 in live footer; weekly report |
//| separator line removed; |
//| Follower menu expanded to 7 rows / 15 buttons: |
//| cmd_weekly: simple weekly P&L + emoji (consistent |
//| with cmd_today and cmd_monthly); |
//| cmd_weekly_full → use Weekly Stats button instead; |
//| cmd_closed: up to 10 closed trades today with |
//| direction, symbol, P&L, close time; |
//| cmd_uptime: EA runtime d/h/m/s, start timestamp, |
//| account number, broker server name; |
//| cmd_be: breakeven status per position — ✅ set / |
//| ⏳ not yet (pts to entry) / ❌ no SL; summary |
//| count; 🔄 Refresh Menu button added as 15th; |
//| 7 chart buttons stacked bottom-left (Status, Verify, |
//| Health, EOD, Weekly, Monthly, Reseed); each has |
//| individual show/hide input; Connection Test (🔌) |
//| bottom-center: pings Telegram getMe API, shows result |
//| as chart label 10 seconds + full detail in MT5 |
//| Journal (bot username, latency ms, HTTP error code); |
//| ConnTestButtonX input controls X position (px); |
//| #property version and all version strings updated to |
//| 2.34 |
//| |
Version 2.342 2026.03.08
v2.342

minor changes in text editing
Version 2.341 2026.03.08
v2.341

minor changes in text editing
Version 2.340 2026.03.08
//| Version: 2.34 |
//| |
//| Changelog: |
//| v2.34 - Live message seeding on startup: any open position |
//| without a tracked msg_id at EA start gets a fresh live |
//| message sent immediately to LiveChannelID — previously |
//| only positions opened during EA runtime were tracked; |
//| Daily P&L report (EOD 23:59) sent automatically every |
//| day via SendDual to ChatID + DailyChannelID Topic; |
//| three cases: closed trades → full stats; no trades but |
//| positions open → float P&L incl. swap; nothing at all |
//| → "Quiet day" confirmation message; tracked via |
//| g_last_daily_report, sent exactly once per calendar day;|
//| Weekly P&L report every Friday at 22:00 server time |
//| via SendDual to ChatID + DailyChannelID Topic; covers |
//| Mon 00:00–Fri 22:00; includes total P&L, trade count, |
//| win rate, avg win/loss, profit factor, best/worst trade |
//| with symbol; tracked via g_last_weekly_report; |
//| both EOD and Weekly coupled to SendClosedPositionsReport:|
//| if false, neither report is sent; DailyChannelID blank |
//| → falls back to ChatID only (consistent with hourly); |
//| 4 new follower menu buttons added (15 total): Weekly |
//| Stats (📆) calls GetWeeklyReport on demand; Closed Today|
//| (📋) lists up to 10 closed trades with P&L and time; |
//| EA Uptime (🕐) shows runtime d/h/m/s, start time, |
//| server name; Breakeven (💹) shows BE status per |
//| position with distance to entry in points, summary |
//| count of BE set / not yet / no SL; |
//| 4 new chart buttons added: Send EOD Report (📅), Send |
//| Weekly Report (📆), Reseed Live Msgs (🔁) — all stacked |
//| bottom-left alongside existing 3 Telegram buttons; |
//| Connection Test (🔌) bottom-center: pings Telegram API |
//| getMe, shows result as chart label for 10 seconds + |
//| full detail in MT5 Journal (bot username, latency ms, |
//| HTTP error code on failure); ConnTestButtonX input |
//| controls X position (default 400px); |
//| #property version and all version strings updated to |
//| 2.34 |
//| |
Version 2.332 2026.03.08
//| Version: 2.332 |
//| |
//| Changelog: |
//| v2.33 - Dual-Posting: Channel + Group Topics simultaneously: |
//| Channel (ChatID) always receives every message in |
//| classic v2.30 style — sequential, no live editing; |
//| Group topics receive same messages separated by type: |
//| LiveChannelID → new/closed trades + live P/L edits |
//| DailyChannelID → daily + status reports |
//| StatusChannelID→ startup, health, EA stop messages |
//| SendDual() — sends to ChatID + specific topic if set; |
//| SendDualGetMsgId() — sends to ChatID (no tracking) + |
//| specific topic (returns msg_id for live editing); |
//| If a topic channel is blank, only ChatID is used — |
//| full backward compatibility with v2.30/v2.31/v2.32; |
//| EditMessage unchanged — topic-only, no channel editing; |
//| Volume reduction + SL/TP mods now EditMessage in |
//| Live Topic if msg_id tracked, else send fresh; |
//| Missed close (reconcile) routed via SendDual to |
//| Live Topic; HFT activate/deactivate routed via |
//| SendDual to Status Topic; Manual Verification routed |
//| via SendDual to Status Topic; |
//| /menu + /start detection fixed for Telegram groups: |
//| commands arrive as /menu@botname in groups — switched |
//| from exact match to StringFind prefix check; |
//| FollowerMenuTitle input added — configurable header |
//| text in follower menu; menu text changed to English; |
//| Follower menu expanded to 6 rows / 11 buttons: |
//| cmd_perf: Win Rate, Avg Win/Loss, Profit Factor |
//| for today and current month; |
//| cmd_risk: DD, Margin Used %, Free Margin, |
//| Margin Level, total lots exposure; |
//| cmd_live: up to 8 open positions with lots, entry, |
//| P/L incl. swap, runtime, total float P/L; |
//| cmd_sltp: SL/TP price + distance in points for |
//| up to 6 open positions; |
//| all existing buttons updated with emoji labels; |
//| UrlEncodeMessage fix: null terminator stripped from |
//| URL encoding loop — prevents %00 corruption in |
//| reply_markup JSON (Telegram Bad Request fix); |
//| Follower cmd/response logging at LogLevel >= 1: |
//| "Follower cmd: [X]" + "Follower resp: [X] → N chars" |
//| #property version and health report version string |
//| updated to 2.33 |
//| |
Version 2.331 2026.03.08
//| Version: 2.331 |
//| |
//| Changelog: |
//| v2.33 - Dual-Posting: Channel + Group Topics simultaneously: |
//| Channel (ChatID) always receives every message in |
//| classic v2.30 style — sequential, no live editing; |
//| Group topics receive same messages separated by type: |
//| LiveChannelID → new/closed trades + live P/L edits |
//| DailyChannelID → daily + status reports |
//| StatusChannelID→ startup, health, EA stop messages |
//| SendDual() — sends to ChatID + specific topic if set; |
//| SendDualGetMsgId() — sends to ChatID (no tracking) + |
//| specific topic (returns msg_id for live editing); |
//| If a topic channel is blank, only ChatID is used — |
//| full backward compatibility with v2.30/v2.31/v2.32; |
//| EditMessage unchanged — topic-only, no channel editing; |
//| Volume reduction + SL/TP mods now EditMessage in |
//| Live Topic if msg_id tracked, else send fresh; |
//| Missed close (reconcile) routed via SendDual to |
//| Live Topic; HFT activate/deactivate routed via |
//| SendDual to Status Topic; Manual Verification routed |
//| via SendDual to Status Topic; |
//| /menu + /start detection fixed for Telegram groups: |
//| commands arrive as /menu@botname in groups — switched |
//| from exact match to StringFind prefix check; |
//| FollowerMenuTitle input added — configurable header |
//| text in follower menu; menu text changed to English; |
//| #property version and health report version string |
//| updated to 2.33 |
//| |
Version 2.330 2026.03.08
//| Version: 2.33 |
//| |
//| Changelog: |
//| v2.33 - Dual-Posting: Channel + Group Topics simultaneously: |
//| Channel (ChatID) always receives every message in |
//| classic v2.30 style — sequential, no live editing; |
//| Group topics receive same messages separated by type: |
//| LiveChannelID → new/closed trades + live P/L edits |
//| DailyChannelID → daily + status reports |
//| StatusChannelID→ startup, health, EA stop messages |
//| SendDual() — sends to ChatID + specific topic if set; |
//| SendDualGetMsgId() — sends to ChatID (no tracking) + |
//| specific topic (returns msg_id for live editing); |
//| If a topic channel is blank, only ChatID is used — |
//| full backward compatibility with v2.30/v2.31/v2.32; |
//| EditMessage unchanged — topic-only, no channel editing |
//| |
//| v2.32 - Forum Topic Support: |
//| All channel ID inputs now accept GROUPID:THREADID |
//| format in addition to plain chat IDs; |
//| ParseChannelStr() helper parses the format and |
//| injects message_thread_id into all outgoing API calls; |
//| SendFollowerMenu/SendFollowerMessage signatures updated |
//| to string channel (was long chat_id) so thread_id is |
//| preserved in follower-chat replies; |
//| HandleCallbackQuery + PollFollowerUpdates updated to |
//| route responses via m_follower_chat_id (topic-aware); |
//| EditMessage unchanged — editMessageText uses message_id |
//| directly, no thread_id required; |
//| Backward compatible: plain chat_id without colon works |
//| exactly as before |
//| |
//| v2.31 - Multi-Channel Broadcasting System: |
//| LiveChannelID: editable live position messages via |
//| editMessageText; message_id tracked per ticket |
//| DailyChannelID: daily P/L reports routed separately |
//| StatusChannelID: status + health reports routed here |
//| FollowerChatID: interactive Telegram chat with inline |
//| keyboard buttons; followers request info on-demand |
//| LiveUpdateInterval: periodic P/L refresh on open trades |
//| New methods: SetChannelOptions, UpdateLivePositions, |
//| PollFollowerUpdates, SendRawToChannel, EditMessage, |
//| AnswerCallbackQuery, SendFollowerMenu, |
//| HandleCallbackQuery, FormatLiveMessage, |
//| live msg persistence (_live_msgs.dat), |
//| getUpdates offset persistence (_upd_offset.dat) |
//| All channels default blank = fall back to ChatID |
Version 2.301 2026.03.07
v2.301 keine Änderung im Code - nur settings neu sortiert:

Reihenfolge jetzt identisch zur Beschreibung: Telegram → Position Tracking → Trade Report General → Opened → Closed → Batch → Health & Reliability → Chart Buttons → Logging → HFT → Message Length Control
Aufgetrennt:

ShowField_Lots/PL/Comment/Magic aus "Position Tracking" raus → eigene Gruppe "Trade Report Fields -- General"
Chart Buttons aus "Health & Reliability" raus → eigene Gruppe "Chart Buttons"
Batch Reporting von hinten nach vorne (direkt nach Position Closed)
DataFolderPath von Ende "Position Closed" nach Ende "Position Tracking"

Kommentare überarbeitet — alle jetzt auf Englisch, präzise und konsistent mit der Beschreibung (z.B. // 0=Minimal, 1=Normal, 2=Verbose, 3=Trace mit Level 3 ergänzt)
Version 2.300 2026.03.07
//| Version: 2.30 |
//| |
//| Changelog: |
//| v2.30 - ShowTradeDetails replaced by 17 individual field |
//| inputs; buyer can now configure exactly which fields |
//| appear in every trade report: |
//| GENERAL: ShowField_Lots, ShowField_PL, |
//| ShowField_Comment, ShowField_Magic |
//| OPENED: ShowField_EntryPrice, ShowField_CurrentPrice, |
//| ShowField_SL, ShowField_TP, ShowField_OpenTime |
//| CLOSED: ShowField_ClosePrice, ShowField_EntryOnClose, |
//| ShowField_Reason, ShowField_OpenedTime, |
//| ShowField_ClosedTime, ShowField_Hold, |
//| ShowField_Swap, ShowField_Commission |
//| All fields default true — no change for existing users;|
//| SetFieldOptions() added to CTelegramPositionReporter; |
//| FormatPositionData + FormatClosedPositionData fully |
//| rewritten to respect individual field flags |
Version 2.290 2026.03.03
//| Changelog: |
//| v2.29 - Logging cleanup — no functional changes: |
//| 6 hardcoded Print("DEBUG ...") statements removed |
//| from OnInit/OnDeinit session flag handling; |
//| replaced with LogPrint() at correct levels: |
//| flag path/written/deleted/startup msg → level 1; |
//| flag write failed + flag kept on shutdown → level 0; |
//| Errors promoted to level 0 (always visible): |
//| Failed to open/write reported tickets file, |
//| failed to open/write volume records file, |
//| failed to send batch position/closed notification; |
//| Verbose-only demoted to level 2: |
//| message splitting info (was level 1); |
//| ReconcileStartupClosures: no closing deal found |
//| (was level 1, fires on every broker history gap); |
//| High-frequency demoted to level 3: |
//| "Processing positions due to tick/timer" |
//| (fires on every tick + every 5s, no diagnostic value) |
//| |
Version 2.280 2026.03.02
//| Changelog: |
//| v2.28 - ShowTrackerStatus input added (default: true); |
//| controls whether "Position Tracker Status" block |
//| (Account, Active positions, Closed session, New/ |
//| Closings/Modifications detected, Detection errors, |
//| Missed reports, Recovery attempts, Check count, |
//| Running since) is included in the status report; |
//| previously hardcoded, always shown; SetTrackerStatus |
//| Option() setter added to CTelegramPositionReporter; |
//| false = cleaner status report without internal |
//| tracker diagnostics |
//| |
Version 2.272 2026.03.02
//| Changelog: |
//| v2.272 - SaveOpenPositionsNow() called directly in |
//| OnTradeTransaction after every DEAL_ADD event; |
//| previously snapshot only written via ForceTrackerSave |
//| (not called in batch mode until batch fires) and |
//| VerificationInterval (300s); now snapshot is |
//| guaranteed current after every deal regardless of |
//| batch mode, VerificationInterval timing, or hard |
//| crash between two deals; covers all order types |
//| (SL, TP, manual, Close-by, partial) at any time |
//| |
//| Snapshot coverage after v2.272: |
//| Normal Shutdown -> OnDeinit |
//| MT5 Update Restart -> OnDeinit |
//| Trade in Non-Batch-Mode -> ForceTrackerSave |
//| Trade in Batch-Mode -> OnTradeTransaction (new)|
//| SL / TP / Manual / Close-by-> OnTradeTransaction (new)|
//| Teilschliesssung -> OnTradeTransaction (new)|
//| Hard-Crash without Trade -> max. 300s (VerifInterval|
//| Quiet Account without Trades -> every 300s |
Version 2.271 2026.03.02
v2.271
//| SaveOpenPositions() also called on OnInit() end and |
//| every VerificationInterval — file exists immediately |
//| at first run and stays current even on quiet accounts |
Version 2.27 2026.03.02
//| Changelog: |
//| v2.27 - Startup reconciliation for missed closures: |
//| SaveOpenPositions() persists all open tickets + |
//| metadata to _open_positions.dat on every |
//| ForceTrackerSave(); ReconcileStartupClosures() |
//| runs on Initialize(), loads saved file, compares |
//| against current open positions; any ticket that |
//| disappeared (closed during weekend / MT5 restart) |
//| is looked up in HistorySelect(7 days back), |
//| DEAL_ENTRY_OUT deal found, ClosedPositionData built, |
//| "Missed Close" Telegram message sent immediately |
//| (priority 7, not batched); skips already-reported |
//| tickets; file deleted + rewritten each session; |
//| startup message shows count of recovered closures; |
//| IsValidClosedPosition() fallback raised 24h -> 7d: |
//| extra safety for broker sync-lag after weekend open; |
//| _open_positions.dat uses same base_path as all other |
//| EA files (DataFolderPath input or default account |
//| folder) — no FILE_COMMON, lives in MQL5/Files/ |
//| |
//| EA writes 4 files total (all in MQL5/Files/): |
//| _reported.dat — closed tickets + timestamps, |
//| binary, 7-day auto-cleanup |
//| _reported.dat.vol — volume reduction records, |
//| binary, per active position |
//| _open_positions.dat — open position snapshot, |
//| text, rewritten each session |
//| _session_active.flag — crash-detection flag, |
//| text, FILE_COMMON (shared |
//| across terminals), deleted on |
//| clean shutdown |
Version 2.26 2026.02.28
//| Changelog: |
//| v2.26 - Chart buttons replace broken input params: |
//| ForceVerification + SendStatusReportNow removed |
//| (EA restarts on settings change = false->true |
//| toggle never detected); 3 OBJ_BUTTON bottom-left: |
//| [Verify Positions] (blau), [Status Report] (gruen), |
//| [Health Report] (orange); OnChartEvent handles |
//| clicks without EA restart; buttons auto-reset after |
//| action; ShowVerifyButton, ShowStatusButton, |
//| ShowHealthButton inputs control visibility; |
//| ButtonYOffset (default 30px) prevents hiding behind |
//| MT5 status bar; ButtonWidth (default 235px) both |
//| adjustable without recompile; created OnInit, |
//| deleted OnDeinit |
Version 2.25 2026.02.24
//| Changelog: |
//| v2.25 - MarkPositionAsReported() no longer calls LogError() for |
//| closed positions (was incrementing m_detection_errors, |
//| potentially triggering false recovery cycles after 5x); |
//| IsValidClosedPosition() uses HistoryDealSelect() direct |
//| instead of HistorySelect(30 days)+full scan in loop |
//| (was O(n*deals) per batch, now O(1) fast path); |
//| Fallback scan reduced from 30 days to 24h (consistent |
//| with rest of EA); en-dash removed from debug prints |
Version 2.24 2026.02.24
//| Changelog: |
//| v2.24 - Clean-stop detection via session_active flag file: |
//| flag written at startup (FILE_COMMON, instance-specific |
//| hash), deleted in OnDeinit only if stop msg sent OK; |
//| Startup message shows warning if previous session ended |
//| without clean stop (MT5 crashed or force-closed) |
Version 2.23 2026.02.24
//| Changelog: |
//| v2.23 - Disk write storm fixed: |
//| CheckVolumeReductions() now only writes .vol file when |
//| volume actually changed (was writing every tick); |
//| AddPositionToReportedList() no longer writes _reported |
//| .dat immediately — sets dirty flag instead; actual save |
//| deferred to ForceTrackerSave() (after batch/individual |
//| send), reducing disk writes from per-tick to per-event; |
//| ForceTrackerSave() flushes dirty reported list; |
//| OnDeinit now calls ForceTrackerSave() before shutdown |
Version 2.22 2026.02.24
//| Changelog: |
//| v2.22 - OnTradeTransaction added: immediate detection of SL/TP |
//| and CloseBy without waiting for next tick/timer; |
//| CloseBy search window expanded 5s → 15s for slow broker |
//| g_is_processing mutex: prevents OnTick+OnTimer double- |
//| fire of ProcessPositions(); |
//| Silent x2 stale-batch purge removed (was dropping |
//| positions before timer could send them as individuals); |
//| m_last_closed_check reset after individual send; |
//| "Closed P/L" label for single closes (was TOTAL); |
//| hardcoded batch overflow cap 50 → dynamic |
//| MathMax(50, Batch_MinPositions * 5) |
//| v2.21 - Logging system overhauled: |
//| CPositionTracker now respects LoggingLevel (was always |
//| silent); LogPrint level 0 always prints regardless of |
//| LoggingLevel; DisableDebugLogging input removed; |
//| level 2 verbose logs added (new/close/modify/recovery) |
//| Messages sent in Health Report now counts all Telegram |
//| messages, not just Status Reports |
//| HFT ALERT fixed: only shows when HFT mode truly active |
Version 2.20 2026.02.24
Changelog:
v2.20 - Batch_MinPositions + Batch_TimeWindowSec added as inputs
unified batch timeout for new and closed positions;
defaults: 4 positions / 10 second window
v2.19 - Added Missed reports counter (positions lost to errors)
Recovery attempts: 30s cooldown prevents explosion
v2.18 - Health report: removed duplicate Uptime/Messages sent
and duplicate Position Tracker Status block;
added Server ping, connection, trade permissions,
free margin, win rate today, message queue status
Version 2.17 2026.02.23
Version: 2.17
Changelog:
v2.17 - Recent Closed: removed 💬 emoji, comment replaced with
SL / TP / MAN label (no value shown)
v2.16 - Fix double brackets in comment: broker sends "[sl]",
code was wrapping again → "[[sl]]", now stripped first
Version 2.15 2026.02.23
Changelog:
v2.15 - RAM cleanup: m_closed[] pruned after 24h (reported),
m_positions[] pruned after 2h (closed+reported),
prevents unbounded memory growth during long sessions
Version 2.14 2026.02.23
Note: The current version is v2.14, not v2.24.

Changelog v2.13 → v2.14
HTML Formatting
∙ All Telegram messages now use parse_mode=HTML
∙ Headlines and labels use <b>bold</b>, separator lines use <code>────</code>
∙ HtmlEscape() added to prevent tag collisions in comments containing <, >, &
Smart Comment
∙ AddClosedPosition() merges position comment (EA name) and deal comment (sl/tp) into "MyEA [sl]" / "MyEA [tp]"
∙ Comment field now always shown in all message types, displays — when empty
Swap & Commission Fix
∙ swap, commission, comment fields added to BatchClosedInfo struct — were previously lost when copied into batch
∙ Commission now summed from both Entry (DEAL_ENTRY_IN) and Exit deal explicitly, fixing brokers that split commission across both sides
Reported Tickets Cleanup
∙ _reported.dat upgraded from v1 (tickets only) to v2 (ticket + timestamp)
∙ Entries older than 7 days are automatically removed on load and save
∙ Backwards compatible — existing v1 files are auto-migrated on first load
∙ LoggingLevel >= 1 logs how many entries were cleaned up
Dead Code Removed
∙ 5 unused file path variables (m_data_folder, m_positions_file, etc.)
∙ 10 stub functions that only returned true or did nothing (WritePositionsToFile, EnsureDirectoryExists, LogDiagnosis, etc.)
∙ m_file_write_errors counter that was never incremented​​​​​​​​​​​​​​​​
Version 2.13 2026.02.22
minor changes in HFT mode detection