Discussing the article: "Trading with the MQL5 Economic Calendar (Part 11): Modular Canvas News Dashboard"

 

Check out the new article: Trading with the MQL5 Economic Calendar (Part 11): Modular Canvas News Dashboard.

We rebuild the MQL5 Economic Calendar dashboard from a monolithic object-based panel into a modular canvas-based system split across four files. The update adds a dual light and dark theme, collapsible day groups, a resizable layout with pixel-based scrolling, revised value markers, and a live countdown with toast notifications. A candidate event cache and a fast-path timer that repaints only changed cells improve responsiveness and make the codebase easier to extend.

Part 10, the entire program lived in a single file. Every concern — UI construction, event filtering, scroll management, hover detection, panel dragging, and trade logic — was handled in one place. The dashboard used MetaTrader 5 chart objects. Each event row required creating and positioning multiple label objects individually, dragging the panel meant repositioning every object on every mouse move, and the scrollbar consisted of three independently managed objects. Colors were hardcoded, and the layout was fixed in size.

Part 11 replaces all of that with a canvas-based rendering system and a four-module architecture. The chart objects are gone. In their place is a single canvas bitmap that the program draws directly onto, with a second canvas on top as a separator overlay. The entire dashboard — background, header, filter chips, event rows, scrollbar, toast, and countdown banner — is rendered in one pass. Because everything is drawn rather than constructed from objects, the layout responds to runtime changes: the dashboard dimensions are variables, column widths scale proportionally, and a full redraw takes one function call.

The program is split across four dedicated modules. The core module owns all shared data — the theme palette, event structs, scroll state, and layout constants. The logic module owns all data operations — loading events, applying filters, building the row plan, and managing trade candidate searches. The render module owns all drawing — it reads from the data layer and paints onto the canvas without modifying state. The interact module owns all user input — translating mouse moves, clicks, drags, and wheel events into state changes and triggering redraws. A sentinel defined in the main entry point prevents duplicate declarations when all four modules compile together. In a nutshell, here is what we intend to achieve.

OBJECTIVES ARCHITECTURE

Author: Allan Munene Mutiiria