EX4 to MQ4 converter
Files with extensions EX4 and MQ4 are related to programming for the MetaTrader 4 (MT4) trading platform. The difference between these files lies in their purpose and content:
- Files with the .ex4 extension are compiled executable files of Expert Advisors, custom indicators and scripts developed for use in the MT4 trading platform. Expert Advisors, indicators and scripts are written in MQL4 programming language and then compiled into .ex4 binary format, which can be loaded directly into MT4 and run in the trading terminal without the need for additional compilation on the user's side.
- Files with the extension .mq4 contain the source code of Expert Advisors, indicators and scripts written in the MQL4 programming language for the MetaTrader 4 platform. These files are text files that can be viewed and edited using text editors or special integrated development environment (IDE) in MT4. After editing the source code, the user has to compile the .mq4 file into an executable .ex4 file before uploading it to the MT4 trading platform.
Conversion between formats
Since the files of both formats under consideration actually contain the same programme code, they can be converted from one to the other. Let's look at this in a little more detail.
Converting MQ4 to EX4
To convert MQ4 files to EX4 format, the integrated development environment (IDE) of the MT4 trading terminal, which is included in the MetaTrader installation package and is called MetaEditor, is intended for converting MQ4 files to EX4 format. To run it, just click the button on the MT4 toolbar. Also, when installing the trading terminal, shortcuts for launching MetaEditor are created on the desktop and in the Windows Start menu.
In the MetaEditor environment it is enough to open the MQ4 file and press the F7 button. If the programme code in the MQL4 language does not contain errors, it will be compiled into a binary code. As a result, a file with the .ex4 extension will be created, which has the same name as the original .mq4 file. The compiled Expert Advisor, indicator or script will also appear in the corresponding list in the Navigator window of the trading terminal.
Converting EX4 to MQ4
The reverse process is much more complicated. Unfortunately, the MetaTrader 4 trading platform does not have a built-in tool for converting EX4 files to the MQ4 format. This was possible until February 2014. In those days, the source code of MQL4 programmes was compiled into the so-called byte-code, from where it could be relatively easily restored to its original state (only comments were lost).
In March 2014, the developer of the MetaTrader trading terminal, MetaQuotes, released MT4 build 600, where the ideology of compiling Expert Advisors, indicators and scripts was radically changed. Since March 2014 and up to the present time, the source code contained in files with MQ4 extension is compiled directly into binary code, i.e. into the format of commands understood by the processor, but not by humans. Unfortunately, it is not possible to create an automatic tool to convert EX4 files to MQ4.
EX4 to MQ4 converter: the solution is found
The good news is that with due diligence and a real-time debugger, it is possible to recreate the source code of an EX4 file by executing it step by step as a trading terminal does. This work takes a lot of time and can be done only by a highly qualified specialist. But the result is often worth the effort — the trader gets a fully restored source code identical to the original. Due to this he can understand the logic of the Expert Advisor's work and, if necessary, make changes to it.
Nowadays, the EX4 to MQ4 converter is implemented in the popular SaaS concept — a trader uploads the source code in EX4 format on the website of a specialised service, where qualified specialists reverse engineer it, test it and verify its identity to the original. After the work is completed, the trader receives the file in MQ4 format.
Service address: https://ex4tomq4.pro/order