Send fill in the background
found it
add this at the end of OnInit()
ChartSetInteger(0,CHART_FOREGROUND,true);
Good find, but just to clarify; CHART_FOREGROUND is for chart objects, not indicator buffers.
If you're working with DRAW_FILLING and want the fill to stay behind the candles, the correct approach is:
#property indicator_zorder -1
That applies only to buffer-based indicators, not to graphical objects like OBJ_RECTANGLE , etc.
Both options are useful, just for different cases.
Good find, but just to clarify; CHART_FOREGROUND is for chart objects, not indicator buffers.
If you're working with DRAW_FILLING and want the fill to stay behind the candles, the correct approach is:
That applies only to buffer-based indicators, not to graphical objects like OBJ_RECTANGLE , etc.
Both options are useful, just for different cases.
thanks
so the foreground way will affect other indicators and objects too so to speak ?
edit :
there is no zorder property
thanks
so the foreground way will affect other indicators and objects too so to speak ?
edit :
there is no zorder property
You're right to try CHART_FOREGROUND, but just to clarify, that affects chart objects, not indicator buffers.
And my apologies; I mistakenly mentioned #property indicator_zorder, which doesn’t exist in MQL5. That property is from TradingView, and I mixed things up.
In MQL5, there's currently no way to control the Z-order of buffer-based drawings like DRAW_FILLING. They are always rendered on top of the chart, with no built-in option to push them behind the candles.
If you need to draw behind, you'd have to use chart objects like OBJ_RECTANGLE and apply:
ObjectSetInteger(0, "name", OBJPROP_BACK, true);
Hope that clears things up! 😉
You're right to try CHART_FOREGROUND, but just to clarify, that affects chart objects, not indicator buffers.
And my apologies; I mistakenly mentioned #property indicator_zorder, which doesn’t exist in MQL5. That property is from TradingView, and I mixed things up.
In MQL5, there's currently no way to control the Z-order of buffer-based drawings like DRAW_FILLING. They are always rendered on top of the chart, with no built-in option to push them behind the candles.
If you need to draw behind, you'd have to use chart objects like OBJ_RECTANGLE and apply:
Hope that clears things up! 😉
ok thanks
Universal solution:
This solution works in almost any scenarios. Two ways to do it.1. Using Chart Settings:
Right-click on the chart and then select Chart on foreground.

2. In mql5 using the ChartSetInteger Function:
ChartSetInteger(0,CHART_FOREGROUND,0,true);Let me know if this solution worked for you . Feel free to message me if any question or just say Hi to be friends here. Thanks
Is there an indicator or plot property to send the fill in the background ?
thanks