MT5 Limitations
ModernUI is built for MetaTrader 5. That means it must work inside MT5’s chart, timer, object, and rendering model.
The library hides a lot of repetitive UI work, but it cannot remove every MT5 limitation.
CCanvas is chart-hosted
ModernUI uses a CCanvas-backed chart object for modern visual rendering.
This means:
- the UI is still inside the MT5 chart
- canvas pixels are flushed to a chart object
- chart redraw timing matters
- full desktop UI behaviour should not be assumed
- partial invalidation can reduce cleared/visited regions, but not every drawing cost disappears
Native input hosts
Text editing uses native chart objects such as OBJ_EDIT.
This is necessary for real text editing behaviour such as typing, caret, selection, copy, and paste.
But it also means:
- native objects must be positioned over the canvas
- hosts must sync geometry and visibility
- clipping can be more complex than pure canvas controls
- cleanup matters in
OnDeinit - some styling is limited by MT5’s native object capabilities
Always call:
void OnDeinit(const int reason)
{
g_ui.Shutdown();
}
Timer resolution
MT5/Windows timer resolution limits how precise performance timing can be.
Counters and logs are useful for trends, but they are not micro-benchmarks.
Do not claim exact sub-millisecond rendering based on these counters.
Chart events
ModernUI depends on chart event forwarding.
If you do not forward OnChartEvent, controls may render but will not interact correctly.
void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
{
g_ui.OnChartEvent(id,lparam,dparam,sparam);
}
Timer-driven repaint
ModernUI examples use:
EventSetMillisecondTimer(16);
and:
void OnTimer()
{
g_ui.OnTimer();
}
This keeps frame processing and canvas updates predictable.
Chart resize and scale
Chart changes can trigger layout/paint updates.
If a panel behaves differently across machines:
- check chart size
- check Windows display scaling
- check DPI mode
- check manual UI scale
- use
LogDpiDiagnostics()
Not a replacement for MT5 charts
ModernUI chart widgets are for dashboard-style UI.
They are not a replacement for MT5’s native price chart.
Use ModernUI charts for compact summaries, dashboards, and supporting visuals.
Use MT5 charts for trading chart analysis.
Image assets and icons
ModernUI can use PNG atlas files under MQL5/Images/ModernUI for sharper common icons. These files are optional runtime assets. If they are missing, the library falls back to canvas-drawn icons.
Atlas images should be loaded once and reused. They are not intended to be loaded or decoded during every paint.
Broker/trading boundaries
ModernUI is a UI library.
It does not:
- place orders
- modify orders
- close positions
- calculate broker margin requirements
- guarantee execution behaviour
- improve trading performance
Trade-style examples are UI-only unless your own EA adds broker logic.
Common mistakes
Expecting browser/CSS behaviour
ModernUI is not HTML/CSS. It is MQL5, CCanvas, chart objects, and native hosts.
Forgetting native object cleanup
If text boxes remain on the chart after EA removal, check g_ui.Shutdown().
Treating performance counters as exact measurement
Use them for development insight, not marketing claims.
Building huge unvirtualized data views
Use virtualized list/table/tree controls for large data.