How to display an Indicator's Background on top of the Candles and other Indicators

 
Hello,

I've modified this indicator but somehow candles and other indicators display on top of its background.



How to get the Background on top of the candles and any other indicator?

I tested modifying this but it's not working:
ObjectSetInteger(0,name,OBJPROP_ZORDER,0);
 

You need to untick the 'Chart on Foreground' option in right click on the chart >> Properties >> Common tab.

 
Eleni Anna Branou #:

You need to untick the 'Chart on Foreground' option in right click on the chart >> Properties >> Common tab.

Thanks for the reply, but I it is already unticked.
Do you know any other way? Possible in code?
 
xBraf #:
Thanks for the reply, but I it is already unticked.
Do you know any other way? Possible in code?

On a closer look I see that your objects are above the chart, so your problem is that you need a background color in this rectangle of your indicator.

I am not a coder myself, so wait for someone who knows to tell you how to do it.

 
xBraf: I've modified this indicator but somehow candles and other indicators display on top of its background. How to get the Background on top of the candles and any other indicator? I tested modifying this but it's not working:
If you need help with your code, you will need to show your code (at least all the relevant parts).
 
Fernando Carreiro #: If you need help with your code, you will need to show your code (at least all the relevant parts).
Hello, Thanks, I attached the code in original post but it seems removed. Here's the full script:
Files:
CM_Strength.mq4  21 kb
 
xBraf #: Thanks, I attached the code in original post but it seems removed.

Please don't use externally linked files. Attach the file directly in your post using the functionality provided with the "+ Attach file" button —  

EDIT: I have edited your most recent post and attached the file for you.

 
Fernando Carreiro #:

Please don't use externally linked files. Attach the file directly in your post using the functionality provided with the "+ Attach file" button —  

Ok.
Files:
 
xBraf:
Hello,

I've modified this indicator but somehow candles and other indicators display on top of its background.



How to get the Background on top of the candles and any other indicator?

I tested modifying this but it's not working:
Ok, the solution was already provided here:
https://www.mql5.com/en/forum/460088#comment_51542151

Set OBJPROP_BACK to false

ObjectSetInteger(chart_ID,name,OBJPROP_BACK,false);

In

void SetPanel(string name,
              int sub_window,
              int x,
              int y,
              int width,
              int height,
              color bg_color,
              color border_clr,
              int border_width)
  {
   if(ObjectCreate(0,name,OBJ_RECTANGLE_LABEL,sub_window,0,0))
     {
      ObjectSetInteger(0,name,OBJPROP_XDISTANCE,x);
      ObjectSetInteger(0,name,OBJPROP_YDISTANCE,y);
      ObjectSetInteger(0,name,OBJPROP_XSIZE,width);
      ObjectSetInteger(0,name,OBJPROP_YSIZE,height);
      ObjectSetInteger(0,name,OBJPROP_BGCOLOR,bg_color);
      ObjectSetInteger(0,name,OBJPROP_BORDER_TYPE,BORDER_FLAT);
      ObjectSetInteger(0,name,OBJPROP_WIDTH,border_width);
      ObjectSetInteger(0,name,OBJPROP_CORNER,CORNER_LEFT_UPPER);
      //ObjectSetInteger(0,name,OBJPROP_STYLE,STYLE_SOLID);
      ObjectSetInteger(0,name,OBJPROP_BACK,false);
      ObjectSetInteger(0,name,OBJPROP_SELECTABLE,0);
      ObjectSetInteger(0,name,OBJPROP_SELECTED,0);
      //ObjectSetInteger(0,name,OBJPROP_HIDDEN,true);
      ObjectSetInteger(0,name,OBJPROP_ZORDER,0);
     }
   ObjectSetInteger(0,name,OBJPROP_BGCOLOR,bg_color);
  }
MT4 Indicator DRAW_ARROW Z Order
MT4 Indicator DRAW_ARROW Z Order
  • 2024.01.06
  • hsharghi
  • www.mql5.com
I've created an indicator to draw an arrow in the middle of a candle...