Performance
ModernUI is built for MetaTrader 5 constraints.
It uses a chart-hosted CCanvas rendering model, targeted invalidation where safe, virtualized data controls, and optional performance counters for development/testing.
This section explains what is efficient, what still costs a full repaint, and what MT5 limitations you should design around.
Performance pages
| Page | Use it for |
|---|---|
| Rendering and invalidation | Dirty rectangles, full vs partial repaint, layout invalidation |
| Performance counters | PerfStatsEnabled, PerfStatsSummary, event queue drops |
| MT5 limitations | CCanvas, chart redraw, OBJ_EDIT, timer resolution, native host caveats |
| Best practices | Practical EA author rules for smooth panels |
Performance philosophy
ModernUI aims for predictable chart-panel performance, not impossible claims.
Good ModernUI performance comes from:
- building a sensible UI tree
- avoiding unnecessary layout changes
- keeping row binding cheap
- using virtualized controls for large lists/tables
- using targeted invalidation where the changed region is known
- forwarding
OnTimerandOnChartEventcorrectly - testing with the performance stress example
What to test
Use the stress test when checking behaviour:
Experts/ModernUI/Examples/ModernUI_Performance_StressTest.mq5
Also useful:
Experts/ModernUI/Examples/DataTable.mq5
Important reality check
ModernUI cannot remove every MT5 limitation.
CCanvas still updates pixels to the chart. Native text inputs still rely on chart objects. MT5 timer resolution affects timing. Chart redraw behaviour is not the same as a native desktop UI toolkit.
The goal is to keep the library practical, predictable, and honest.