global initialization failed!!!!!!! - page 3

 

Thanks for the hints!

Since 646 strange things are going on, and nobody seems to be able to help out!

1. Labels are getting out of line, as if the XDISTANCE and YDISTANCE weren't obeyed.

They get back in-line only after switching Tf's back and forth.

After switching chart windows or changing parameters input, they get out of line.

2. Some old indis crash the MT4.

3. After starting MT4 it first logs into the account, after a while it logs out, and I must log in again.

4. Scripts and EA's with OrderClose() don't work, they don't close the orders.

OrderModify() works fine.

What can we do to make MetaQuotes do something about it???

After all, MT4 is a trading platform, thus a serious tool, not some toy!!!

Oh, and one more thing:

Say, I'm creating a rectangle with an indi, based on some calculations.

The calculations are inside the start().

Still, I don't see my rectangle after starting MT4, not even on ticks.

But, after reinitializing the indi or switching Tf's, it's there.

Now, these kind of things never happened before!

 
Dadas:

Thanks for the hints!

Since 646 strange things are going on, and nobody seems to be able to help out!

1. Labels are getting out of line, as if the XDISTANCE and YDISTANCE weren't obeyed.

They get back in-line only after switching Tf's back and forth.

After switching chart windows or changing parameters input, they get out of line.

that means you can fix it in your code

2. Some old indis crash the MT4.

you have to adapt the code to the new world, (B600 >) for instance "zero divide" is a critical error and make the indicator disappear (it wasn't before B600)

3. After starting MT4 it first logs into the account, after a while it logs out, and I must log in again.

try to close all the open charts leave the terminal blank (without charts open), restart the terminal, if the problem continues, report to service desk

4. Scripts and EA's with OrderClose() don't work, they don't close the orders.

I'm sure the problem is in your code, show us the relevant code and someone will try help you

OrderModify() works fine.

What can we do to make MetaQuotes do something about it???

After all, MT4 is a trading platform, thus a serious tool, not some toy!!!

i agree, but i think (almost sure) the critical error is in your code, you are using code out of date, i.e. it was written with errors at the time, errors that didn't stop the indicator/EA from working, but now they are crucial errors and need to be fixed

 

Dadas,

I'm a fellow developer and can't answer all your questions. I'm dealing with some PITA issues myself in apps that I intend to take commercial. One thing I definitely suggest, is replacing at least your init and deinit functions with new OnInit() and OnDeInit() functions. You might also want to replace start with OnStart(). According to the documentation, the implementation is supposed to be backwards compatible but my experience speaks to the contrary. I had a situation on one of my indies in which deinit() was not being called. My deinit() was deleting objects and anything that caused a re-initialization failed because the objects still existed. I do still use start() rather than OnStart() but I'm not sure of the wisdom of that. I have a hunch that I'm asking for trouble down the line. Let me know what happens if you choose to try my suggestions. We Devs need to stick together. :-)

 
Dadas:

Oh, and one more thing:

Say, I'm creating a rectangle with an indi, based on some calculations.

The calculations are inside the start().

Still, I don't see my rectangle after starting MT4, not even on ticks.

But, after reinitializing the indi or switching Tf's, it's there.

Now, these kind of things never happened before!


as i wrote above, there is new world is ahead of us
don't you "start" use "OnTick" (EA) or "OnCalculate" (indicator)
 
qjol:

as i wrote above, new world is ahead of us
don't you "start" use "OnTick"


Look, MetaQuotes is releasing a platform which, like ProfessorMetal says, is supposed to be backwards compatible!

I don't think anybody is capable of rewriting all the thousands of already existing indicators, scripts and EA's.

As far as your suggestions that my codes are wrong, I don't agree, some of the labels are just the simplest codes.

There is nothing to them, they create a label object, calculate something, then set the object accordingly.

There is no special philosophy attached to:

  ObjectSet    ("Lot_Size_Label",OBJPROP_CORNER,Corner);

  ObjectSet    ("Lot_Size_Label",OBJPROP_XDISTANCE,XDistance);
  ObjectSet    ("Lot_Size_Label",OBJPROP_YDISTANCE,YDistance);
  ObjectSetText("Lot_Size_Label",comment,Font_Size,Font_Type,Font_Color);
  ObjectSet    ("Lot_Size_Label",OBJPROP_SELECTABLE,false); 

As for the order closing scripts and EA's, I'm talking about ones that used to work fine on earlier Builds (500).

So, that is not an issue of my codes being correct or not.

It is the issue of MetaQuotes screwing things up!

I will try out hints by ProfessorMetal, still, what about the users who don't know a thing about coding???

And, frankly speaking, they aren't even supposed to know anything coding!

They are supposed to be using the trading platform!!!

 
ProfessorMetal:

Dadas,

I'm a fellow developer and can't answer all your questions. I'm dealing with some PITA issues myself in apps that I intend to take commercial. One thing I definitely suggest, is replacing at least your init and deinit functions with new OnInit() and OnDeInit() functions. You might also want to replace start with OnStart(). According to the documentation, the implementation is supposed to be backwards compatible but my experience speaks to the contrary. I had a situation on one of my indies in which deinit() was not being called. My deinit() was deleting objects and anything that caused a re-initialization failed because the objects still existed. I do still use start() rather than OnStart() but I'm not sure of the wisdom of that. I have a hunch that I'm asking for trouble down the line. Let me know what happens if you choose to try my suggestions. We Devs need to stick together. :-)


Thanks, I had the same issue with the objects not being deleted on deinit.

I was developing some indi, and got these strange results, then I saw on the objects list, they were still there.

I got around that, probably in the simplest way, by ObjectDelete() in the start().

Yup, changing init() to OnInit() and deinit() to OnDeinit() got the labels back right! Thanks!

Then after a while, it didn't!!! They are still doing the same dance.

 

If the code is the simplest one, implementing it really depends on the codes that being implemented. You need to have error checking at crucial points so that when error happens, the indi/ea can handle it correctly. I also have problems last time but once I put the error handlers, it runs smoothly to the point you forgot the problems that arises last time.


still, what about the users who don't know a thing about coding???

And, frankly speaking, they aren't even supposed to know anything coding!

They are supposed to be using the trading platform!!!

The platform is a metatrader, and comes with all basic needs, nobody forces you to code.

 

You know what helped align the labels?

My X,Y coordinates are taken from externs.

extern int XDISTANCE =9;
extern int YDISTANCE =9;

Then:

int X,Y;

int OnInit()
  {
 X = XDISTANCE;
 Y = YDISTANCE;
 ObjectCreate("INSTR",OBJ_LABEL,0,0,0); 
 
    return(0);
  }

int start() {
        ObjectSet("INSTR",OBJPROP_CORNER,Corner);
        ObjectSetText("INSTR",Symbol_Period+Date_Time,FontSize, "Berlin Sans FB", Color);
        ObjectSet("INSTR", OBJPROP_XDISTANCE, X);
        ObjectSet("INSTR", OBJPROP_YDISTANCE, Y); 
        ObjectSet("INSTR", OBJPROP_SELECTABLE, false);   
   return(0);
  }

This way it gets it right.

Or, rather, makes thing better, not exactly right.

 
deysmacro:

If the code is the simplest one, implementing it really depends on the codes that being implemented.


The platform is a metatrader, and comes with all basic needs, nobody forces you to code.


How's your comment supposed to help anybody???
 
int X,Y;

int OnInit()
  {
 X = XDISTANCE;
 Y = YDISTANCE;
 ObjectCreate("INSTR",OBJ_LABEL,0,0,0); 
 
    return(0);
  }

int start() {
        ObjectSet("INSTR",OBJPROP_CORNER,Corner);
        ObjectSetText("INSTR",Symbol_Period+Date_Time,FontSize, "Berlin Sans FB", Color);
        ObjectSet("INSTR", OBJPROP_XDISTANCE, X);
        ObjectSet("INSTR", OBJPROP_YDISTANCE, Y); 
        ObjectSet("INSTR", OBJPROP_SELECTABLE, false);   
   return(0);
  }

You don't put any object find function to check if the object already exist or not. From there, then you create the object accordingly.


How's your comment supposed to help anybody??? 

I am helping you, right now.

Reason: