What is EX4 Opener?

The EX4 opener is the MetaEditor application which is part of the MetaTrader 4 software package. It is a program code editor for MQL4 language and compiler at the same time.

However, before you open an EX4 file in MetaEditor you must save it as MQ4. Why is it so and how to do it? Let's find out!

Files with EX4 extension can be run only by MetaTrader 4 application. This is the most popular trading platform on the FOREX market, which is also the execution environment for trading robots. A trading robot is a software that automates the process of making deals on the market. The code of a trading robot is created in the MQL4 programming language using the MetaEditor program and saved in the MQ4 format. However, before the trading robot can be run, it must be compiled.

What is compilation?

Compilation is the process of convertation of the program text, comprehensible to man, into the executable code, comprehensible to a computer. The compilation process checks the syntax and logical consistency of the source code. If no errors are found, the compiler creates an executable file from the source code. Unnecessary information, such as comments, names of variables and functions, is discarded. The executable file of the trading robot for MetaTrader 4 has the EX4 extension.

The compilation allows to get the high speed of execution, which is crucial for trading on the FOREX market. The downside of this coin is the impossibility to read and edit the machine code. In fact, a file with the EX4 extension can only be opened for execution.

What if you need to make changes in the logic of a trading robot? There are two ways of doing it:

  1. Ask the developer to provide the source code
  2. If this is not possible, decompile the file, i.e. convert it to the MQ4 format

What is decompilation?

Decompilation is essentially the opposite process from compilation. During decompiling, an attempt is made to convert executable code understandable by a computer into programming code in one of the programming languages, for example MQL4. It may sound simple, but in fact it is far from it.

The fact is that during the compilation process, as mentioned above, some of the information important for a human being is discarded. But that is not the main point. The main difficulty is that the compiler optimizes the code trying to make it faster and more compact. In this case the logic of program execution becomes closer to the system of processor commands, which has little in common with human logic. Besides, in some cases code obfuscation and even its encryption are applied. All this makes automatic decompilation almost impossible.

Decompiling is in many respects a creative process where skilled professionals who have created many thousands of trading robots use a real-time debugger to step-by-step execute the executable code and try to reconstruct the logic of its work. The source code is actually recreated from scratch, but if it is successful, it exactly corresponds to the one created by the developer.

How to decompile and open an EX4 file?

As we mentioned above, automatic decompiling of EX4 files is not possible. It's done almost entirely manually and requires a lot of time and expertise.

The good news is that nowadays, you don't need to be a trading, programming and reverse engineering guru to decompile EX4 files by yourself. There are online services that can help you do this. The oldest and most reliable service in this niche is EX4 to MQ4 Team. This collective has been working since 2005 and has a lot of experience in decompilation. If you have a need to edit the source code but for some reason don't have an MQ4 file, you should definitely go here.

So, what is an EX4 file opener?

To summarize. Files with the EX4 extension are executable and can be run for execution in MetaTrader 4. The MetaEditor application is an opener for this type of files. To open an EX4 file for editing, perform the following actions:

  • Decompile a file. You can do it here
  • Save the resulting source code in the MQ4 format
  • Use the MetaEditor as EX4 opener

If you still have questions concerning the EX4 file format, you can ask the experts.