You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Mql5 is basically an OOP version of Mql4 just as C++ is to C.
As with C++, theres no-need to use OOP_Paradigm. You can write your codes in Procedural_Paradigm. Intermediate->Advanced Mql4 programmers will have no problem writing in Mql5 Procedural ( using just the Documentations ). If however, someone wants to write OOP then that person would find better learning explanations through C++ materials for example.
I wouldn't use OOP unless I need an Object Data Type. If there's no benefit to creating two-or-more instances of a Class/Structure I would just use Procedural. I would use OOP for Data_Base heavy programs. Example, the Order_Object which needs (String, Integer and Double) packaged into one User Defined Data Type / Object. This should help mql4 create more complex programs for those wanting to built such programs.
Those are my opinions anyway.
RaptorUK
Some things in mql5 are very, very different, for example Order handling . . . you cannot have multiple open Orders on the same symbol, they combine to make a single position. You can do multi-symbol testing in the Strategy Tester, but you cannot use your own data so testing with real tick data is not possible.
Ignoring OOP specifically, One thing the old MQL4 really lacked (which it has now) was some kind of compound datatype (aka Structures / Records etc). Even C had these, they have been around a LONG time in programming because they are so fundamentally useful. (Probably since the late 70s maybe earlier).
So if anyone plans to stick with MQL4 but has no interest in OOP features, they might want to look at structures(records) as a bare minimum...
Having them it really changes the expressiveness of the language, and people might miss this being scared off by the additional OOP features.
Eg imagine writing code to manage the trading sessions in old MQL.
In procedural languages there are two general approaches:
1. Write a procedure/function you call each time you want to know when a session starts, and ends.
2. As above but also cache the information to avoid recalculating. Make it data centric rather than calculation centric.
One might decide on the latter approach to make for much faster code. So in old MQL4 you might find yourself defining arrays to hold information for each session eg:
You have to manage each session as a bit of information from each of the arrays. Luckily Sessions are faily static so its not too bad, but if it were something that could change whilst EA is running (eg storing historical Pivot Points S2,S1,PP,R1,R2 ) the code becomes a lot more difficult to manage...
However in new MQL4 you can start off using structures ...
(and eventually replace then with classes ) once you start learning OO.
Once you get the hang of structures, classes become a fairly simple next step.. (ie instead of having global functions to manipulate your structures,
have the functions only accesible with the related data...
Then slowly learn about more advance OOP concepts if needed...
Ignoring OOP specifically, One thing the old MQL4 really lacked (which it has now) was some kind of compound datatype (aka Structures / Records etc). Even C had these, they have been around a LONG time in programming because they are so fundamentally useful. (Probably since the late 70s maybe earlier).
So if anyone plans to stick with MQL4 but has no interest in OOP features, they might want to look at structures(records) as a bare minimum...
Having them it really changes the expressiveness of the language, and people might miss this being scared off by the additional OOP features.
Eg imagine writing code to manage the trading sessions in old MQL.
In procedural languages there are two general approaches:
1. Write a procedure/function you call each time you want to know when a session starts, and ends.
2. As above but also cache the information to avoid recalculating. Make it data centric rather than calculation centric.
One might decide on the latter approach to make for much faster code. So in old MQL4 you might find yourself defining arrays to hold information for each session eg:
You have to manage each session as a bit of information from each of the arrays. Luckily Sessions are faily static so its not too bad, but if it were something that could change whilst EA is running (eg storing historical Pivot Points S2,S1,PP,R1,R2 ) the code becomes a lot more difficult to manage...
However in new MQL4 you can start off using structures ...
(and eventually replace then with classes ) once you start learning OO.
Once you get the hang of structures, classes become a fairly simple next step.. (ie instead of having global functions to manipulate your structures,
have the functions only accesible with the related data...
Then slowly learn about more advance OOP concepts if needed...
When I reply I get the same box as the prior post so I am replying here.
I programmed OOP back in the 90's and found there was way too much overhead.
I went back to C. I am glad for the structures and, hopefully, pointers so I can do data structures like btrees and neural nets but OOP is not really needed.
My biggest concern is what bugs will appear when more OOP is used.
I already got an error, not a warning, about overwritiing a function in the language and this is supported in Visual C++.
I am very capable at coding in C and just wish MQ would start with a compiler that works in the basic language before adding MT4 stuff.
Robert
When I reply I get the same box as the prior post so I am replying here.
add <br> to the end of the html
Hello, will old MQL4 be soon deprecated ? like start(), ini(), deinit() ? tey say they are still here for compatibility, sounds like they will be removed soon.
Actually I like OOP more than procedural, I try to learn MQL5 to code in MT4 but unfortunately there are some differences between them too even until now.... like there is no MqlTradeRequest Struct in MQL4 but weirdly there is MqlTicjk in the new MT4 Language... also why didn't MQL4 just make the new overloaded OrderSend function that accepts MqlTradeRequest and MqlTradeResult like in MQL5 beside the old one with many arguments.
So this makes things harder for us, they say they fully import the MQL5 Abilities so I thought we can just learn MQL5 if we want to code in the new MQL4 but actually they didn't...
MQL5 gives a "very poor OOP" and only makes the code confusing and hard to make simple things, you can spent easily 2 or 3 times more time writing the same thing for MQL5 when in MQL4 was very straigth forward to do, and normally a simple indicator can fastly be transformed in little big monster of code on MQL5.
MQL5 doesn't not give real benefits that justify transform 1 line of code in 6 or 7 to do the same thing...
Nowadays I can't see a real reason that justify this kind of "evolution" way actually is exactly the opposite.
Performance is not the only thing in the world that matters, that's why there's a lot of languages that abstract this, maintainability is too very, or more, important. I'm not say that we can't do things in a low level to achieve some deserved perfomance numbers, but it not must be exclusive.
I think one of the big things that was made the MQL4 so popular, or the most popular language that where was made thousans of robots and indicators, it's exactly the asnwer for why MQL5 is so little used in community.
MQL5 gives a "very poor OOP" and only makes the code confusing and hard to make simple things, you can spent easily 2 or 3 times more time writing the same thing for MQL5 when in MQL4 was very straigth forward to do, and normally a simple indicator can fastly be transformed in little big monster of code on MQL5.
MQL5 doesn't not give real benefits that justify transform 1 line of code in 6 or 7 to do the same thing...
Nowadays I can't see a real reason that justify this kind of "evolution" way actually is exactly the opposite.
Performance is not the only thing in the world that matters, that's why there's a lot of languages that abstract this, maintainability is too very, or more, important. I'm not say that we can't do things in a low level to achieve some deserved perfomance numbers, but it not must be exclusive.
I think one of the big things that was made the MQL4 so popular, or the most popular language that where was made thousans of robots and indicators, it's exactly the asnwer for why MQL5 is so little used in community.