Send fill in the background

 

Is there an indicator or plot property to send the fill in the background ? 

thanks 


 

found it

add this at the end of OnInit()

ChartSetInteger(0,CHART_FOREGROUND,true);
 
Lorentzos Roussos #:

found it

add this at the end of OnInit()

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.

 
Miguel Angel Vico Alba #:

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

 
Lorentzos Roussos #:

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! 😉

 
Miguel Angel Vico Alba #:

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