Rectangle to fill or not to fill?

 

I would like to draw a rectangle in the background of the chart but with no colour fill.

It looks like I need to set the 'back' property to FALSE in order to do this but I would like the 'back' property to be TRUE if possible so that the border lines do not draw over other objects.

Is there a way to do this please?

void DrawRectangle(string name,double level1, double level2, bool back, bool fill, color col, int width)
{
 ObjectCreate(name, OBJ_RECTANGLE,0,time1,level1,time2 ,level2);
 ObjectSetInteger(0,name,OBJPROP_COLOR,col);
 ObjectSetInteger(0,name,OBJPROP_FILL,fill);
 ObjectSetInteger(0,name,OBJPROP_STYLE,STYLE_SOLID);
 ObjectSetInteger(0,name,OBJPROP_WIDTH,width);
 ObjectSetInteger(0,name,OBJPROP_BACK,back);
 ObjectSetInteger(0,name,OBJPROP_SELECTABLE, False);
}
 
sd59:

I would like to draw a rectangle in the background of the chart but with no colour fill.

It looks like I need to set the 'back' property to FALSE in order to do this but I would like the 'back' property to be TRUE if possible so that the border lines do not draw over other objects.

Is there a way to do this please?

there is a way to set the order of display of objects so you can push it to the back. WIth property ZORDER. Read the documentation about it and using ZORDER will allow you to choose which objects go on top or below. It's like a priority to show objects in front or back .

It should work like adding 

ObjectSetInteger(0,name_sell,OBJPROP_ZORDER,100); 

as a extra property to all objects

 
Tomas Rodriguez Doherty:

there is a way to set the order of display of objects so you can push it to the back. WIth property ZORDER. Read the documentation about it and using ZORDER will allow you to choose which objects go on top or below. It's like a priority to show objects in front or back .

It should work like adding 

ObjectSetInteger(0,name_sell,OBJPROP_ZORDER,100); 

as a extra property to all objects

I have tried changing the z-order but this doesn't seem to make any difference.

If I set this condition the object is put in the background but also fills with colour even though I set the 'fill' property to False. This is the main issue I feel.

ObjectSetInteger(0,name,OBJPROP_BACK,True);
ObjectSetInteger(0,name,OBJPROP_FILL,False);
 
  ObjectCreate(ChartID(),"TLIBRAFOR"+line_name,OBJ_RECTANGLE,0,start_time,Close[1],Time[1],Close[1]);
  ObjectSetInteger(ChartID(),"TLIBRAFOR"+line_name,OBJPROP_COLOR,clrBlack);
  ObjectSetInteger(ChartID(),"TLIBRAFOR"+line_name,OBJPROP_WIDTH,1);
  ObjectSetInteger(ChartID(),"TLIBRAFOR"+line_name,OBJPROP_SELECTABLE,0);  
  ObjectSetInteger(ChartID(),"TLIBRAFOR"+line_name,OBJPROP_SELECTED,0);
  ObjectSetInteger(ChartID(),"TLIBRAFOR"+line_name,OBJPROP_RAY,false);  
  ObjectSetInteger(ChartID(),"TLIBRAFOR"+line_name,OBJPROP_STYLE,STYLE_DASHDOTDOT); 
  ObjectSetInteger(ChartID(),"TLIBRAFOR"+line_name,OBJPROP_BGCOLOR,clrNONE);
  ObjectSetInteger(ChartID(),"TLIBRAFOR"+line_name,OBJPROP_FILL,false);
  ObjectSetInteger(ChartID(),"TLIBRAFOR"+line_name,OBJPROP_BACK,false);
 
sd59:

I would like to draw a rectangle in the background of the chart but with no colour fill.

It looks like I need to set the 'back' property to FALSE in order to do this but I would like the 'back' property to be TRUE if possible so that the border lines do not draw over other objects.

Is there a way to do this please?

see here

https://www.mql5.com/en/forum/392167#comment_28588249

Draw rectangle only with borders
Draw rectangle only with borders
  • 2022.03.27
  • www.mql5.com
Dear all, hope you are fine, I need to draw rectangle objets but only with borders, no background (check attached samples...
 
sd59:

I would like to draw a rectangle in the background of the chart but with no colour fill.

It looks like I need to set the 'back' property to FALSE in order to do this but I would like the 'back' property to be TRUE if possible so that the border lines do not draw over other objects.

Is there a way to do this please?

Hi! Did you solve this problem? I think you need to include the Canvas 

Reason: