This exposition examines ex4 decompiler projects on GitHub: what they are, why they matter, how they work, practical capabilities and limits, legal/ethical considerations, and how to evaluate or reproduce such a project. It’s written to be technically specific and engaging for reverse engineers, security researchers, and advanced traders curious about the internals of MetaTrader 4 (MT4) Expert Advisors (EAs).
ex4-decompiler by nilium (Python)Stars: ~200+ (before takedowns)
Status: Frequently cloned but often removed.
This lightweight Python script reads the EX4 structure, parses the symbol table, and attempts to reconstruct the control flow graph. It is excellent for simple indicators but struggles with complex EAs over 2000 lines.
While specific project popularity can change over time, here are a few types of projects you might find: ex4 decompiler github
How it works: It automates the use of older decompiler executables (like ex4_to_mq4.exe) by faking drag-and-drop operations.
| Scenario | Why Avoid Decompilation | |----------|------------------------| | You plan to resell the EA | Pure copyright violation. You will be banned from MQL5 Market. | | The EA uses a DLL | DLL calls cannot be decompiled. The resulting MQ4 will be broken. | | The EA is obfuscated | Obfuscators (e.g., MQuoter, EA Obfuscator) intentionally break decompilers. Output will crash MT4. | | You lack MQL4 coding skills | Decompiled code requires heavy manual fixes. If you cannot read MQL4, you cannot use the output. | Ex4 Decompiler — deep dive into the GitHub
The tool performs the following steps:
The Hurdle: Ghidra does not natively support the EX4/EX5 format. To use it, you would need to write a custom loader to handle MetaTrader's specific binary format. 🚩 Critical Warnings Popular EX4 Decompiler Projects on GitHub While specific
The repository ex4-decompiler (Python-based) was selected for in-depth analysis.
Pros: