anyway to set obj prop at creation?

 
Is there anyway to create an obj with custom prop, rather than using objectsetxxx function
 
pavelion: Is there anyway to create an obj with custom prop, rather than using objectsetxxx function
No, all the graphical objects have predefined properties.
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Properties
Documentation on MQL5: Constants, Enumerations and Structures / Objects Constants / Object Properties
  • www.mql5.com
Object Properties - Objects Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Fernando Carreiro #:
No, all the graphical objects have predefined properties.
ah... so when you create a new obj by mt5 gui, the new obj will be created by the previous obj prop, not the predefined prop
 
pavelion #: ah... so when you create a new obj by mt5 gui, the new obj will be created by the previous obj prop, not the predefined prop

There seems to be a miscommunication here.

There is a difference between "properties" and "property values".

In your initial post you ask about creating new "properties". You did not ask about to their values being the same as the previous usage in the GUI.

Please explain in more detail.

 
Here a new Topic:

   There's an odd behaviour by using OBJPROP_TIMEFRAMES. I have an invisible obj which is the first created obj in the chart. By using OBJPROP_TIMEFRAMES to make it visible then that obj looks like it is the latest obj created. Is this a bug? how to fix it?
 
pavelion #: There's an odd behaviour by using OBJPROP_TIMEFRAMES. I have an invisible obj which is the first created obj in the chart. By using OBJPROP_TIMEFRAMES to make it visible then that obj looks like it is the latest obj created. Is this a bug? how to fix it?

Your question is unclear. I am unable to understand your question. Please explain in more detail, hopefully with a code sample and possibly a screenshot or two.

 
Fernando Carreiro #:

Your question is unclear. I am unable to understand your question. Please explain in more detail, hopefully with a code sample and possibly a screenshot or two.

well we have two objs(1 and 2). 1 is created first which is invisible, and 2 is created latter. so 2 is in front/foreground while 1 is in back.
The problem is when I use OBJPROP_TIMEFRAMES to make 1 visible, then 1 becomes the visible and it is in front/foreground of all objs. 
 
pavelion #: well we have two objs(1 and 2). 1 is created first which is invisible, and 2 is created latter. so 2 is in front/foreground while 1 is in back.
The problem is when I use OBJPROP_TIMEFRAMES to make 1 visible, then 1 becomes the visible and it is in front/foreground of all objs. 
Please provide sample code to reproduce the issue.
 
Fernando Carreiro #:
Please provide sample code to reproduce the issue.
void OnStart(void)
  {
   ObjectCreate(0,"First",OBJ_BITMAP,0,iTime(NULL,0,0),iClose(NULL,0,0));
   ObjectSetString(0,"First",OBJPROP_BMPFILE,"\\Images\\dollar.bmp");
   ObjectSetInteger(0,"First",OBJPROP_TIMEFRAMES,OBJ_NO_PERIODS);
   ObjectCreate(0,"Second",OBJ_BITMAP,0,iTime(NULL,0,0),iClose(NULL,0,0));
   ObjectSetString(0,"Second",OBJPROP_BMPFILE,"\\Images\\euro.bmp");
   ObjectSetInteger(0,"First",OBJPROP_TIMEFRAMES,OBJ_ALL_PERIODS);
   ChartRedraw();
  }
 
pavelion #:

Yes, you are correct! I have tested your code and I have also tested various combinations of different sequence of the code.

I also experimented with the Z Order to see if it would affect it, but it did not.

Every time one changes the "period" visibility, it brings the object to the top.

I don't know if this can be classified as a bug or if there is some other explanation, but I could not find anything in the documentation to explain the behaviour.

 
Fernando Carreiro #:
Every time one changes the "period" visibility, it brings the object to the top.

We can probably state that when OBJPROP_TIMEFRAMES is changed, the object is moved to the top, just like when an object is created. Then all that remains is to simply take this into account.

I delete and re-create the dashboard every time after creating OBJ_HLINE (I'm talking about OBJ_HLINE, which are created by the same advisor/indicator. I do not track objects created by other programs or manually)
(And this experience was in MQL4, but I think that in MQL5 things are exactly the same).