I continue to be amazed by the ability of the Metaquotes company to steam roll their users with their automatic updates that introduce massive changes that should only belong within an Alpha release. This week the Metatrader 4 platform has been updated to build 600+ on many brokers – via an automatic process that does not even ask the user – breaking a lot of previous functionality and making a lot of indicator and expert advisor implementations completely useless. Imagine if you’re trading something live and suddenly it gets completely killed by a platform update (that you didn’t even ask for) that simply changes the entire way in which the programming language functions and interacts with other programs. Within this post I will share with you some tips to deal with the latest Metaquotes joke on Forex traders, giving you some information that will hopefully help you avoid any chaos in the short term and eventually migrate your implementations in the longer term.
First of all, lets talk about ways in which you can prevent this and future updates from happening at all. The automatic update functionality is a complete monstrosity and therefore those of us seeking to have more control and stability should think about completely disabling it. Metaquotes does not offer any official path to do this but you can disable this functionality by deleting the live and web install functionality that the Metatrader 4 platform uses. In order to do this first make sure you enable the view of hidden/files and folders within windows explorer and then proceed to delete the Metaquotes folder within your C:\ProgramData folder (on windows 7/8) and any Metaquotes folder within your C:\Documents and Settings\AllUser\Application Data and C:\Documents and Settings\YourUser\Application Data folders. Deleting these folders on pre-600 builds will not affects the functioning of your MT4 platform (as far as I’ve experienced) and it will prevent the automatic update functionality from doing anything to your platforms. Additionally remember to always keep a zipped copy of your MT4 platforms as backup, in case there is anything that Metaquotes does that breaks any functionality.
Although the above solves the problem temporarily, it does not solve it completely as Metaquotes will probably decide to eliminate the use of pre-600 builds eventually, forcing anyone who wants to trade with their platform to update to newer builds. In order to update our code to work with the 600+ build environment, we should first consider some changes introduced in this release and the reason for them. Metaquotes decided to update the MT4 platform significantly in order to carry out a merging plan between MT4/MT5. Since the MT5 platform was by all accounts a failure among traders – guess which stubborn company failed to implement all user suggestions, like a history center – the company was faced with the prospect of losing all this work and having to continously support an old platform (Metatrader 4). The company then decided to implement MT5 functionality in MT4 in order to slowly convert one platform into another. Metaquote’s objective seems to be to slowly turn MT4 into MT5 and eventually unify both platform and force an update to an MT5 hybrid like platform.
The biggest change in build 600 is that the MT4/MT5 compilers are now unified into one, meaning that several things were changed to allow for this compatibility. Most importantly, several new variable types have been added and some previous types have entirely changed their definition. If you have variables with names like “char” or “new” these will need to be changed to accommodate for the new types. Additionally there have been important changes to the RateInfo types, which have now changed to match the structure of the Metatrader 5 platform. Previously you could use the ArrayCopyRates function in MT4 to obtain an array of RateInfo that contained time and Open/High/Low/Close/Volume information, now this structure contains additional values representing spreads, tick volume and real volume. If you were using the ArrayCopyRates function to copy rates you should now stop using it and instead use the MT5 functions for this purpose (CopyRates) and modify any usage of the resulting variables to accommodate for the new structures (note that you will now put the result into an array of MqlRates instead of an array of double, since the new compiler supports structures). If you’re using a DLL to interface with your program and receive data you will also need to make changes to accommodate for these new structures. Note that if you have already coded MT5 versions of your code you will probably have an easier time using these on MT4.
Another important change pertains to string variables. Strings are no longer the same as they were in the previous MQL4 language implementation. Strings in MT4 were previously a pointer to a character array along with a long integer variable that contained the length of the string. This has now changed and the string no longer represents such a structure. If you’re passing strings to external libraries it is probably safer for you to convert these strings in MT4 to an array of char (use the StringToCharArray function) and pass this to your external libraries as char*. This is the way in which this worked in MT5 and it will probably be the way in which it will work in MT4 from now on. You probably will need to convert your experts and indicators to work with MT5 functions if they do not work outside of the box, which will probably be the case if you’re using any important level of complexity within your code (such as calls to DLLs, etc).
Now don’t get me wrong, I am all for change and code improvements and many of the things that Metaquotes has done with the MQL4 language are good. There is now a debugger, access to an object oriented trading approach, etc, but this is simply not the way to roll out updates with such important changes. With many people using MT4 as a critical application for their trading, the rolling of anything on an automated fashion without user consent is absurd. If it was my company I would have introduced an explicit warning within the platform about such updates (obviously requiring user permission for updating) and I would have also warned that users should test their implementations on a demo before updating. But then again, Metaquotes seems to enjoy being a bully to their end-users (their customers are the brokers, not us) so it seems that anyone using MT4/5 will have to endure this in the long run. If you are looking for a solution, take a look at our F4 framework.
If you would like to migrate outside of the MT4/5 Metaquotes domain and enjoy trading using paid open-source solutions where you can control everything related to your trading (including updates!) please consider joining Asirikuy.com, a website filled with educational videos, trading systems, development and a sound, honest and transparent approach towards automated trading in general . I hope you enjoyed this article ! :o)