New MetaTrader 4 build 1160 - page 5

 
googollien:

Hello, Philippe, thanks for kindly sharing information. :)

I am cool with the 1160 build now, just NEVER USE OPERATOR OVERLOAD / OVERLAP FUNCTIONS, then things go well.

Please stop wrong recommendation.

You claim there is a bug in MT4 while you are unable to prove it. All I have seen is problem in your code.

        return this;

What do you think it is doing ? 'this' is not a pointer.

 

Well, there are quite unpleasant changes in the compiler.

The boolean functions must return boolean (no int, char conversion) The struct(s) now cannot be declared in a method scope. So I am renaming and fixing a lot of them and moving them to the class scope. But I can go over it.

But what is worse, I have serious performance problems, and I cannot profile nor debug the code, as I have the icons missing (though the code compiles and runs in the terminal):

despite the same code in MT5 does have them:


Does any one know what makes the icons visible?

 

Well one bug still hasn't been fixed: When you close a chart, the UnInit Return code is still REASON_CLOSE, not REASON_CHARTCLOSE as it's supposed to be.

 
shoxie:

Well one bug still hasn't been fixed: When you close a chart, the UnInit Return code is still REASON_CLOSE, not REASON_CHARTCLOSE as it's supposed to be.

Yes
 
kypa:

Hello, Mr. MetaTrader!

Why did you spread a boolean function that returns -1 to hundreds of clients?

If you checked out the link I attached, I just used the comparedoubles function the way it was shared and recommended by senior forum users. It has always worked fine. And the default value is never used, it's just there to avoid compilation warnings. And up until this build, -1 was a valid way of expressing 'false'. While I agree with you that it would have been more correct to use true or false, I don't see a reason to make this invalid, especially since I am sure there are thousands of EAs out there that are using this particular code, not just mine.
 
-1 is boolean true
 
shoxie:

Well one bug still hasn't been fixed: When you close a chart, the UnInit Return code is still REASON_CLOSE, not REASON_CHARTCLOSE as it's supposed to be.

Cant' reproduce that. After closing a chart :

void OnDeinit(const int reason)
  {
   printf(reason);
  }

2018.12.17 14:24:57.369    169174 EURUSD,M1: uninit reason 4

 

Did anyone manage to get the new menu option "Debug/Start Profiling on History Data" working?

(I can't get it to work on MT4)

 
Alain Verleyen:

Please stop wrong recommendation.

You claim there is a bug in MT4 while you are unable to prove it. All I have seen is problem in your code.

What do you think it is doing ? 'this' is not a pointer.

Okay, thank you for telling that.

Let me not to claim any bug first, but I am just wondering 4 things,

  1. if this is a mistake syntax, why does the MetaEditor not complain any error after compiling?
  2. the same, if this is a problem code, why does it work without any trouble in previous build?
  3. MT4 output does not complain any run-time errors during strategy tester is running.
  4. If I can not use "this" or "GetPointer( this )" to indicate the union / struct itself, what should I use?
    Like these codes?

decimal decimal::operator+=( const decimal b )
{
        decimal a;

        a._dec = _dec;		//_dec is the sub struct in the union "decimal"
        a = a + b;

        return a;
}


With all my respect, I don't want to prove any bug, I think it has no bug, so re-compile it after just updated,
but the MT4 crashed in front of my eyes.

The compiler do not report any syntax errors at the lines you claim those are my problems, and EA runs
like everything is normally, included all values calculations and program logic runs correctly, what truth
should I think?

However, the pointer idea seems not so clear like C++ in MQL4, so maybe it is just a suggestion, if somewhere
the codes should not use "this" to present the current struct itself, would you please let the MetaEditor show
some warning message or errors?

Thanks.


 
Alain Verleyen:

Please stop wrong recommendation.

You claim there is a bug in MT4 while you are unable to prove it. All I have seen is problem in your code.

What do you think it is doing ? 'this' is not a pointer.

Sorry, I just looked into MQL4 reference about "this":

Keyword this

A variable of class type (object) can be passed both by reference and by pointer. As well as reference, the pointer allows having access to an object. After the object pointer is declared, the new operator should be applied to it to create and initialize it.

The reserved word this is intended for obtaining the reference of the object to itself, which is available inside class or structure methods. this always references to the object, in the method of which it is used, and the expression GetPointer(this) gives the pointer of the object, whose member is the function, in which call of GetPointer() is performed. In MQL4 functions can't return objects, but they can return the object pointer. 


So,

  1. Is this paragraph in the MQL4 Reference of Build 1160 has some outdated description?
  2. Is "union" different with "structure" meaning here?
  3. I mistook the meaning of "The reserved word this is intended for obtaining the reference of the object to itself, which is available inside class or structure methods", did I?

No offense, I just wanna know how to do it correctly in my codes.

Thanks for help.

Reason: