Download MetaTrader 5

ObjectCreate works in init but not start

To add comments, please log in or register
Adam 2015.06.28 22:01 
Just like the subject says, I can create an object fine in init but if I try it in start I get nothing. I'm playing around with the FX Multi Meter II code and was wondering if there is something that might be preventing it from being created but I can't find anything. I've tried it in all different locations within the start function and still get nothing.
Keith Watford
Keith Watford 2015.06.28 23:37  

Difficult without seeing the code.

What error report are you getting?

Possibly, if you have already created the object, you cannot create a new object with the same name unless you delete the first one. 

Adam 2015.06.29 01:40  
I am using the following code to create the object which I use in all my programs to debug certain variables, the main body of the start function is about 700 lines so IDK if it will fit.
      ObjectCreate("ObjName", OBJ_LABEL, 0, 0, 0);
      ObjectSetText("ObjName","Open Trade: "+OpenTrade+" Position: "+Position+" Arrow: "+ArrowUp+ArrowDown+" Strength: "+Strength+" Error:"+GetLastError(),25, "Verdana", Red);
      ObjectSet("ObjName", OBJPROP_CORNER, 0);
      ObjectSet("ObjName", OBJPROP_XDISTANCE, 20);
      ObjectSet("ObjName", OBJPROP_YDISTANCE, 20);
whroeder1 2015.06.29 16:59  
Don't call GetLastError (_LastError) unless you have an error. Your snippet is showing the ObjectCreate error which will always fail after the first tick.
To add comments, please log in or register