Article-22597-MQL5-Economic-Calendar-Modular-Canvas-Dashboard This repository is an article-derived reference project based on the original MQL5 article. It does not claim to reproduce the full original source code unless files are explicitly attached. ## Overview Reference repository for MQL5 article 22597 describing a refactor of an economic news dashboard from a monolithic chart-object implementation into a modular canvas-based system. The article presents a four-module architecture: - core data/state module - logic module - rendering module - interaction module It also discusses a dual-theme UI, runtime resizing, pixel-based scrolling, collapsible day groups, unit-aware calendar value formatting, live remain/countdown updates, and toast notifications. ## Original Article - **Article ID:** 22597 - **Title:** MQL5 Economic Calendar Dashboard, Part 11 - **Author:** Allan Munene Mutiiria - **Publication date:** 2026.05.26 - **Category:** Trading / GUI - **URL:** https://www.mql5.com/en/articles/22597 ## Repository Purpose This repository is intended as a technical reference/reconstruction project for the article’s architecture and code organization. Its purpose is to preserve and organize the article-described implementation details for: - modular MQL5 EA design - canvas-based dashboard rendering - economic calendar event visualization - interaction handling without chart objects - pre-news trading workflow integration ## Key Concepts - Canvas-based dashboard rendering with `CCanvas` - Separation of concerns across `.mqh` modules - Runtime-resizable layout with width/height bounds - Pixel-based scrolling with draggable scrollbar thumb - Proportional table column scaling - Unit-aware formatting for calendar values - Relative time formatting for upcoming/released events - Collapsible day-group row planning - Hit-testing and hover-code action dispatch - Crop-based canvas resizing instead of bitmap reallocation - Timer-driven partial repaint of changing cells - Trade deduplication using stable calendar event IDs ## Algorithm / Architecture Summary The article describes an Expert Advisor structured around a thin main entry point and four supporting modules: 1. **Main EA file** - declares inputs - embeds CSV resource for tester mode - includes all modules - forwards `OnInit`, `OnDeinit`, `OnTick`, `OnChartEvent`, and `OnTimer` 2. **Core module** - stores layout constants, dashboard size state, theme palette, font/glyph constants - defines scrollbar state and helpers - computes scalable column widths - formats calendar values and remaining time strings 3. **Logic module** - loads events from live calendar API - stores metadata such as unit, multiplier, digits, and event IDs - applies filters - builds a row plan with day separator rows - supports collapse/expand state per day group - supports trade candidate search and deduplication 4. **Render module** - draws the dashboard header, filters, rows, scrollbar, countdown banner, and toast - caches interactive rectangles for later hit-testing - uses a main canvas plus a separator overlay canvas 5. **Interact module** - converts chart coordinates to dashboard-local coordinates - performs pixel-level hit-testing - dispatches actions based on hover codes - manages dragging, edge resizing, wheel scrolling, and canvas lifecycle The article emphasizes allocating canvases at maximum size once, then resizing by changing the visible crop, reducing drag-time reallocation overhead. ## Mentioned or Attached Files ### Explicitly attached files - `MQL5 News Calendar EA PART 11.mq5` — main Expert Advisor entry point - `News Core.mqh` — shared state, layout, theme, formatting, scroll helpers - `News Interact.mqh` — hit-testing, action dispatch, drag/resize handling, canvas lifecycle - `News Logic.mqh` — event loading, filtering, row planning, trading logic - `News Render.mqh` — dashboard drawing and visual update routines - `EconomicCalendar.csv` — embedded resource for strategy tester mode ### Files only mentioned in text - Part 10 article/source from the earlier monolithic implementation - MQL5 Trading Tools series referenced for canvas drawing fundamentals ## Statistics - **Modules described:** 4 - **Primary language:** MQL5 - **Main program type:** Expert Advisor - **Attached source files in article:** 6 - **UI rendering approach:** Canvas bitmap labels - **Article series position:** Part 11 ## Tags `MQL5` `MetaTrader5` `Economic-Calendar` `Canvas` `Dashboard` `Expert-Advisor` `UI` `Modular-Architecture` `Scrolling` `Event-Filtering` ## Difficulty **Intermediate to Advanced** Requires familiarity with: - MQL5 event handlers - `CCanvas` - MT5 Economic Calendar API - custom UI rendering - state-driven interaction design - EA modularization ## Limitations - The repository is article-derived; full compile-ready original source is only supported to the extent of the explicitly attached files listed in the article. - Some implementation details are described narratively rather than fully reproduced in the processed input. - The article references additional prior work and shared helpers; not all supporting context is included here. - Build success may depend on the presence and placement of `EconomicCalendar.csv` as described by the article. - This README does not assume undocumented installation or usage steps beyond what the article states. ## Reference - Original article: https://www.mql5.com/en/articles/22597 - MQL5 Economic Calendar: https://www.mql5.com/en/economic-calendar - MQL5 `CCanvas` documentation: https://www.mql5.com/en/docs/standardlibrary/canvasgraphics/ccanvas