In this article, we explain what the decompiling process is, as well as in what cases it can be useful. If you want to know more about the process of decompilation then you should read the full article. Feel free to send us an email to [email protected] if you have any question.
Note: Most of the concepts discussed in this article are known by those who are dedicated to programming. So if you are a programmer but want more details about the specific case of MT4 decompilation, you might prefer to go directly to the last sections.
|What is decompile or decompiling process?|
|Source code and executable file in MetaTrader 4 (MT4)|
|In what cases do I need to decompile a program?|
|Some useful tips|
What is decompile or decompiling process?
Basically, decompiling is obtaining the source code of an executable program. This definition would be enough for a programmer. For people without basic programming skills, it is necessary to explain more in depth.
The source code is what the programmer has written. That is, it is those lines of characters (sometimes ordered) that the programmer shows you, and that you can not understand, even if you nod your head.
Instead, the executable file is what the computer understands. This file is obtained by compiling the source code. This is necessary because the computer does not “speak” the same language as humans. So we could say that, when compiling, we make a kind of “translation” of what the programmer has written to what the computer understands.
In summary, compiling is “translating” the code written by the programmer (source code) into a language that is comprehensible by the computer (executable file). Likewise, decompile would be the inverse process. That is, obtain the code written by the programmer (source) from the program used by the computer (executable).
Source code and executable file in MetaTrader 4 (MT4)
In the specific case of MT4, there are two file formats: ‘.ex4’ for the executable files (e.g., ‘Accelerator.ex4’) and ‘.mq4’ (e.g., ‘Accelerator.mq4’) for the source code. These are the types of files that are usually stored in the corresponding folders of the MT4 platform. However, the MT4 platform only uses the executable files, so that only these files are necessary to use an EA, an indicator or any other MT4 program. The source code is only used by a programmer to make corrections, adjustments, modifications or improvements in the MT4 program.
EX4 files are primarily based on:
- MetaQuotes Software Corp. proprietary protection system based on bytecode of MQL4 programming language;
- encryption of all data blocks and special obfuscation methods aimed against hackers;
- additional protection against reversing and cracking with VM Protect (http://vmpsoft.com)
The MQL4 programming language permits making complete applications which may be passed, sold and leased. Each such associate application has the EX4 file extension and is protected against decompilation using special software protection system. The following restrictions apply to such files: modification, disassembly and decompilation of EX4 files.
The above-mentioned protection system is a standalone application exclusive rights to which belong to MetaQuotes Software Corp. Having said that, we urge you to respect the aforementioned rights, as well as intellectual property and copyrights.
In what cases do I need to decompile a program?
These are some of the most common cases:
- To modify, correct and/or improve an MT4 program.
- To recover a lost source code.
- It is very useful to learn MQL4 programming. MQL4 is the programming language used in MetaTrader 4.
- Unfortunately, it is also used to appropriate the work done by other programmers.
Let’s see a practical example. Suppose you want to take an MT4 program to MT5, so you must convert your MQL4 code into MQL5 code. In this case, you need the source code of the MQL4 program in order to convert it into MQL5. If you only have the executable file (file with ex4 extension), then you need to decompile this file to get the source code (file with mq4 extension).
Some useful tips
- You don’t need the source code (mq4 file) in order to build an MT4 Expert Advisor (EA) based on an indicator. In fact, an MT4 EA only uses the compiled file (ex4 extension). Thus, no matter if you have the indicator source code, our MT4 programmers will be able to develop an MT4 EA only with the ex4 file.
- Do you know that we can implement alerts and notifications for an indicator even without the source code (mq4 file)? Indeed, a skilled MT4 programmer can develop a new indicator that gets the signals from the original indicator and sends alerts and notifications whenever a signal is triggered. Don’t hesitate to ask us about this interesting option to get alerts from an indicator even without the mq4 file.