Discussion of article "Cross-Platform Expert Advisor: Reuse of Components from the MQL5 Standard Library"

 

New article Cross-Platform Expert Advisor: Reuse of Components from the MQL5 Standard Library has been published:

There exists some components in the MQL5 Standard Library that may prove to be useful in the MQL4 version of cross-platform expert advisors. This article deals with a method of making certain components of the MQL5 Standard Library compatible with the MQL4 compiler.

Similar to what was discussed in the first article, we use a common header file which would, ideally, consolidate the similarities in code between the MQL4 and MQL5 versions. It is actually possible to rewrite the CSymbolInfo class into three separate files so that the similarities can be shared in a single file, and the differences be coded in the other two class files. However, in this article, we will deal with the easier (and faster) approach: copy the MQL5 CSymbolInfo class file, and then comment the lines that incompatible with MQL4. For both versions, however, the resulting file structure would look like the following:

SymbolInfo file structure

Author: Enrico Lambino

 

Hi!

You write at the beginning: "However, its main disadvantage is that we don't have to rewrite a lot of code."

You mean "..  advantage .." - correct?

 
Hi,
Very nice job and clear explanations. I'll stay in touch, as at that time nothing to reward you with, just words. THANKS !
 

I never understood why someone want to use a wrapper class like SymbolInfo ?

There is only 1 useful function : 

double CSymbolInfo::NormalizePrice(const double price) const

All the rest is just overload to slow down your code. A well code coded Symbol class could be useful, this "standard" one is just useless. Don't even want to talk about "CAccountInfo".

 @Enrico Lambino why didn't you create your own classes instead  ?