Troubleshooting
This page covers runtime problems: the EA compiles, but the UI does not show, does not respond, does not repaint, or leaves objects behind.
For compiler errors, see Common compile errors.
The panel does not appear
Most likely causes
g_ui.Init(...)failed.SetRoot(...)was not called.- The UI tree was created but not attached.
- The EA was attached to the wrong chart/subwindow.
- The chart object prefix conflicts with another EA.
- There is a runtime error in
OnInit()before the UI is built.
Fix
Start from the minimum root pattern.
MuiRoot g_ui;
int OnInit()
{
if(!g_ui.Init(ChartID(),0,"MyUI_",512,16))
return(INIT_FAILED);
MuiPage *page=new MuiPage();
page.Title("Demo");
g_ui.SetRoot(page);
EventSetMillisecondTimer(16);
return(INIT_SUCCEEDED);
}
Check the Experts tab for errors.
How to verify
Compile and attach a supplied example such as:
Experts/ModernUI/Examples/BasicPanel.mq5
If a supplied example works, the issue is probably in your EA setup.
The panel appears but does not respond
Most likely cause
OnChartEvent() is not forwarded into MuiRoot.
Fix
Add this to the EA:
void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
{
g_ui.OnChartEvent(id,lparam,dparam,sparam);
}
How to verify
Click a button in a supplied example. If it responds there but not in your EA, compare the event forwarding.
The panel does not repaint or update reliably
Most likely cause
OnTimer() is not forwarded into MuiRoot, or the timer is not set.
Fix
Add the timer in OnInit():
EventSetMillisecondTimer(16);
Forward OnTimer():
void OnTimer()
{
g_ui.OnTimer();
}
How to verify
Use a demo that updates labels, toasts, or status rows and confirm the UI updates after interaction.
Text boxes or native inputs remain on the chart after removing the EA
Most likely cause
g_ui.Shutdown() is missing from OnDeinit().
Native text hosts may use MT5 chart objects such as OBJ_EDIT. Shutdown lets ModernUI remove those objects cleanly.
Fix
void OnDeinit(const int reason)
{
g_ui.Shutdown();
}
How to verify
Attach an example with a text box, remove it from the chart, and confirm no input objects remain.
Controls are visible but disabled or not clickable
Possible causes
- A parent container is disabled.
- A modal/dialog/drawer overlay is receiving input first.
- A control is covered by another overlay element.
- The control is outside a clipped scroll area.
- The chart event is not reaching the root.
Fix
Check:
- Parent visibility/enabled state.
- Whether a modal or drawer is open.
- Whether
OnChartEvent()is forwarded. - Whether the control is inside a scroll/clipped container.
Hover or focus visuals look stale
Possible causes
- A custom control paints outside its
PaintBounds(). - A handler changes a visual state without invalidating.
- Code requested layout/paint in the wrong order.
- A partial invalidation region is too small.
Fix
For normal controls, call:
control.Refresh();
For geometry changes, use:
control.Relayout();
If you built a custom control that paints outside its layout rect, adjust its paint bounds.
Atlas icons do not appear
Most likely cause
The optional atlas PNGs are not installed under MQL5/Images/ModernUI.
Fix
Copy this package folder:
Images/ModernUI/
To:
MQL5/Images/ModernUI/
The UI should still work without these files because ModernUI falls back to canvas-drawn icons.
Large lists or tables feel slow
Possible causes
- Expensive work in
BindRow. - Expensive work in
CellText. - Rebuilding the UI tree too often.
- Calling
Relayout()on frequent value changes that did not move geometry. - Using simple helpers for large dynamic datasets.
Fix
Use source-backed virtualized controls for large data and keep row binding cheap.
See:
A trade-style example does not place trades
This is expected.
ModernUI trade-style examples are UI-only unless your own EA adds broker logic.
They do not place, modify, or close real orders.
Still stuck?
Create a minimal reproduction and include the details listed in Reporting a bug.