Discussing the article: "Creating a Cairo-Inspired Graphics Library for MetaTrader 5 (Part 1): Why the terminal needs its own 2D-renderer Contents"
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Creating a Cairo-Inspired Graphics Library for MetaTrader 5 (Part 1): Why the terminal needs its own 2D-renderer Contents.
This article opens a step-by-step 2D graphics engine for MetaTrader. It standardizes ARGB colors and implements a reusable surface: a uint pixel buffer uploaded as a dynamic resource and shown via one OBJ_BITMAP_LABEL. You will draw rectangles and a vertical gradient, check real transparency, and learn an efficient update path with a single Flush call.
Modern trading interfaces demand more than a grid of rectangles: rounded cards, rings and donuts, semi-transparent layers, smooth gradients, and arbitrary polygons are all standard UI ingredients. MQL5's native chart objects and even the standard CCanvas fall short: corners are square, fills are hard-edged, there is no true alpha in object background colors, geometry is whole-number only, and object counts can quickly affect responsiveness. At the same time, we want to stay entirely inside the terminal—no DLLs, no external tools—and present the result as a single chart object.
This series takes a different route. Instead of inventing a new architecture, we borrow the compact, battle-tested design of Cairo. Its core idea—keeping geometry (paths) separate from paint (sources), then resolving them through a per-pixel coverage mask before compositing onto the destination—provides a common foundation for smooth, scalable rendering across different shapes. Over the coming parts, we will implement that model in pure MQL5, one small, verifiable step at a time.
Part 1 establishes the rendering foundation: a single ARGB color representation and a reusable pixel surface bound to one OBJ_BITMAP_LABEL . From there, the later parts will change how pixels are selected and painted, while the mechanism that delivers them to the chart remains the same.
Author: Sandro Begashvili