Just fix the default values in your method declarations. It will take 10 minutes maximum (less than creating a topic on the forum)
class CTrade { public: bool Buy(string pSymbol, double pVolume, double pStop = 0, double pProfit = 0, string pComment = NULL); } bool CTrade::Buy(string pSymbol,double pVolume,double pStop=0.000000,double pProfit=0.000000,string pComment=NULL)
0 and 0.0 are different values (roughly speaking). Don't use 0 as the default value for a parameter of type double.
Fix for your Buy() method
bool Buy(string pSymbol, double pVolume, double pStop = 0.0, double pProfit = 0.0, string pComment = NULL);
Hi,
MetaQuotes-developers, please check this out:
The code in the attached file CustomTrade.mqh, which compiled just fine under MetaEditor version 4570, suddenly throws 20 errors under MetaEditor version 4585 !!!
The only thing that changed was the MetaEditor version (and not my code).
Please check (compile) for yourself.
Also attached, please find the included file errordescription.mqh
Please explain and fix ASAP and make sure your changes to the compliler don't keep wrecking our codes (again and again).
Thank you
It seems that the compiler is now more accurate, in my point of view.
For example, for your class method "OpenPending", your declaration and implementation are different in that you define the default initial values of a different datatype.
In you class declaration as ...
And in your implementation as ...class CTrade { protected: bool OpenPending( string pSymbol, ENUM_ORDER_TYPE pType, double pVolume, double pPrice, double pStop = 0, double pProfit = 0, double pStopLimit = 0, datetime pExpiration = 0, string pComment = NULL );
bool CTrade::OpenPending( string pSymbol, ENUM_ORDER_TYPE pType, double pVolume, double pPrice, double pStop=0.000000, double pProfit=0.000000, double pStopLimit = 0, datetime pExpiration=0, string pComment = NULL )
So, in your declaration you used integer literals, but in your implementation you used floating point literals instead.
In my opinion, the compiler is correct in identifying the issue. Whether it should be warning instead of error might be subjective, but I definitely agree that it should be identified as an issue.
EDIT: Had your code being correct in the first place, then this would not have caused an issue with the newer compiler.
Just fix the default values in your method declarations. It will take 10 minutes maximum (less than creating a topic on the forum)
0 and 0.0 are different values (roughly speaking). Don't use 0 as the default value for a parameter of type double.
Fix for your Buy() method
This is not the issue.
They somehow broken the compiler.
It was happening for me on CCanvas class. I solved it switching to beta version for while.
If you don't know, CTrade and CCanvas are from the standard library, it should work as it is.
In my case the issues was for the methods that use enum as parameters.What do you mean that's not the problem? I fixed half of his errors while I was writing my post (replacing 0 with 0.0). I was too lazy to fix the other half.
The problem is not in the compiler, the problem is in the code
Cool. It did not work for enums. Anyway such updates should include updates on the affected files of the standard library, isn't it?
Anyway such updates should include updates on the affected files of the standard library, isn't it?
The author of the topic had a problem with his custom code, not with the standard library code.
It's just that "intellisense" doesn't see the difference between 0 and 0.0.
And it's also a little annoying that "intellisense" writes 0.000000 instead of 0.0.
Just fix the default values in your method declarations. It will take 10 minutes maximum (less than creating a topic on the forum)
Interesting proposal and tone after breaking users' codes for no compelling reason.
Here comes my counter-proposal:
Rather implement code folding, keyword-occurrence-highlighting etc. in MetaEditor to make it a modern IDE instead of fiddling with a working compiler for no discernible benefit.
If this sounds rude then so was your answer, too.
Seriously, thanks for making MetaTrader & MetaEditor, but I think you really should re-prioritize your development pipeline. The compiler is the least problem.
Rather implement code folding, keyword-occurrence-highlighting etc. in MetaEditor to make it a modern IDE instead of fiddling with a working compiler for no discernible benefit.
If this sounds rude then so was your answer, too.
Seriously, thanks for making MetaTrader & MetaEditor, but I think you really should re-prioritize your development pipeline. The compiler is the least problem.
Of course, you can set priorities for someone else's business better than people who have been successfully running it for about 30 years. Especially considering the fact that you are not paying for the implementation of the functionality you ask for.
Judging by MQ's public statements, the main priority now is the development of a new compiler.
If I'm not mistaken, they also said that they were going to improve the metaeditor, but after developing a new compiler. They also abandoned the subversion storage in favor of a git based storage and will continue to develop this in the future along with improving the functionality of the projects.
And you complain that the compiler is now more strict about your incorrectly written code.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
MetaQuotes-developers, please check this out:
The code in the attached file CustomTrade.mqh, which compiled just fine under MetaEditor version 4570, suddenly throws 20 errors under MetaEditor version 4585 !!!
The only thing that changed was the MetaEditor version (and not my code).
Please check (compile) for yourself.
Also attached, please find the included file errordescription.mqh
Please explain and fix ASAP and make sure your changes to the compliler don't keep wrecking our codes (again and again).
Thank you