Please confirm this BUG - Chart Objects

 

OBJPROP_ZORDER and hand drawn chart objects have a bug.
No need to post code for one to see it, although it affects coded indicators, EA - anything that draws chart objects.

You can use trendlines, horizontal lines, text, etc and see it happen with all.

To see it yourself try this.

1. Place two text items on chart each with a different color (the different colors allow you to see it take effect). Make one Yellow and one Black.

2. Place Black text object so it partly overlaps on top of the Yellow text object.

3. Close and restart MetaTrader build 610 or whatever you have.

4. Yellow is now on top of black!

5. Close and restart MetaTrader again.

6. Black is now on top of yellow.

A continuous cycle. Object stacking order is impossible to manage.

Thank you

 

When making bug reports you should post code to reproduce the problem.

 

Sure, I'll post some code if it makes people happy, but as mentioned above code IS NOT the problem. This problem is internal with how MetaTrader stacks chart objects.

green and red text switch stacking order each time MT4 is restarted.

#property indicator_chart_window

extern color BrokerTimeColor=Red;
extern color ComputerTimeColor=Lime;
extern int   DistanceFromTopLeft=10;
extern double ZoomLevel=1;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   ObjectCreate("Label_bt", OBJ_LABEL, 0, 0, 0);  // Creating obj.
   ObjectSet("Label_bt", OBJPROP_CORNER, 0);    // Reference corner
   ObjectSet("Label_bt", OBJPROP_XDISTANCE, DistanceFromTopLeft*ZoomLevel);// X coordinate   
   ObjectSet("Label_bt", OBJPROP_YDISTANCE, 30*ZoomLevel);// Y coordinate

   ObjectCreate("Label_ct", OBJ_LABEL, 0, 0, 0);  // Creating obj.
   ObjectSet("Label_ct", OBJPROP_CORNER, 0);    // Reference corner
   ObjectSet("Label_ct", OBJPROP_XDISTANCE, DistanceFromTopLeft*ZoomLevel);// X coordinate   
   ObjectSet("Label_ct", OBJPROP_YDISTANCE, 40*ZoomLevel);// Y coordinate

//----
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  
//----
   ObjectSetText("Label_bt",TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS),20*ZoomLevel,"Arial",BrokerTimeColor);
   ObjectSetText("Label_ct",TimeToStr(TimeLocal(),TIME_DATE|TIME_SECONDS),20*ZoomLevel,"Arial",ComputerTimeColor);
//----
   return(0);
  }
 
JPS:

Sure, I'll post some code if it makes people happy, but as mentioned above code IS NOT the problem.


I wasnt doubting you. I suggested you post your code because that is standard procedure when making bug reports. It helps those who might need to address the issue get to it without having to duplicate what you already did. It just saves time.
 
There are quite a lot of bugs in MT4 graphics, I gave up to report them, as it seems the feature is still under construction. Setting the OBJPROP_ZORDER porperty always returned false for me. Moreover, if the objects overlap, the top-visible one is not the one that receives mouse events.
 
SDC, I understand what you mean. Thank you.

Ovo, has MetaTrader confirmed to you or responded somewhere that object features are in fact still under construction? I've searched and found nothing. Did anyone respond to your reports? Would you be able to share the links?
 
JPS:
SDC, I understand what you mean. Thank you.

Ovo, has MetaTrader confirmed to you or responded somewhere that object features are in fact still under construction? I've searched and found nothing. Did anyone respond to your reports? Would you be able to share the links?

The only contact I have been using is the service desk. Yes, they respond, mostly within a couple of days. Nobody confirmed anything about a degree of current implementation. The service desk does not allow public links and there is no public tracker I would know about.
 

Thanks Ovo. I wasn't as lucky to get responses, even a private message to stringo (slawa), no responses :(

I find it odd as well that not a single Moderator has visited this thread. Perhaps build 600+ has been overwhelming for them I imagine.

 

No problem.

I accept that a new product of such range will have bugs. The effective way of solving bugs is the bug tracker, rather than private messages. The entry point to the tracker is the Service desk, because the public input still must be filtered.

On the other hand I do not accept that we are not informed about pending or unfinished parts. It is useless to report "it does not work at all", because they know about it - but we do not, and we are losing precious time.

 
JPS:

Thanks Ovo. I wasn't as lucky to get responses, even a private message to stringo (slawa), no responses :(

I find it odd as well that not a single Moderator has visited this thread. Perhaps build 600+ has been overwhelming for them I imagine.

Do you think this thread needs Moderating ? if not why do you expect some action from a Moderator ? it seems you contacted the Service Desk, did you post a follow up message to your ticket asking for an update ?
 

This code places three objects over each other, you can see the red and blue objects use OBJPROP_BACK,true. The green one uses OBJPROP_BACK,false.

The green one with the false always remains on top.

You will notice the red and blue "back" objects still change their position reletive to each other every time the terminal is restarted but the green object always stays in the correct position on the top.

That is a workaround if there are only two objects to layer, more than two and there is still a problem.

It is not a coding problem though really. It is a terminal problem. When objects are left on the chart the terminal objects list reverses their order every time the terminal is restarted. I think the terminal is saving the chart objects in reverse order in the chart .ini file, and then re loading them in that order when the terminal is restarted so they get flipped around every time... it should be a simple fix to make the terminal save the objects in the order they are in the Objects list from top down and thefore force the terminal to reload them in that same order when it is restarted.

//+---------------------------------------------------- --------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- object bug test
   
   ObjectCreate(0,"shape0",OBJ_RECTANGLE_LABEL,0,0,0,0);
   ObjectSetInteger(0,"shape0",OBJPROP_BGCOLOR,clrRed);
   ObjectSetInteger(0,"shape0",OBJPROP_XDISTANCE,100);
   ObjectSetInteger(0,"shape0",OBJPROP_YDISTANCE,100);
   ObjectSetInteger(0,"shape0",OBJPROP_XSIZE,100);
   ObjectSetInteger(0,"shape0",OBJPROP_YSIZE,100);
   ObjectSetInteger(0,"shape0",OBJPROP_BACK,true);
   
   ObjectCreate(0,"shape1",OBJ_RECTANGLE_LABEL,0,0,0,0);
   ObjectSetInteger(0,"shape1",OBJPROP_BGCOLOR,clrBlue);
   ObjectSetInteger(0,"shape1",OBJPROP_XDISTANCE,110);
   ObjectSetInteger(0,"shape1",OBJPROP_YDISTANCE,110);
   ObjectSetInteger(0,"shape1",OBJPROP_XSIZE,100);
   ObjectSetInteger(0,"shape1",OBJPROP_YSIZE,100);
   ObjectSetInteger(0,"shape1",OBJPROP_BACK,true);
   
   ObjectCreate(0,"shape2",OBJ_RECTANGLE_LABEL,0,0,0,0);
   ObjectSetInteger(0,"shape2",OBJPROP_BGCOLOR,clrGreen);
   ObjectSetInteger(0,"shape2",OBJPROP_XDISTANCE,120);
   ObjectSetInteger(0,"shape2",OBJPROP_YDISTANCE,120);
   ObjectSetInteger(0,"shape2",OBJPROP_XSIZE,100);
   ObjectSetInteger(0,"shape2",OBJPROP_YSIZE,100);
   ObjectSetInteger(0,"shape2",OBJPROP_BACK,false);
  }
Reason: