What is the EX4 file format?
.ex4 files are created to facilitate the functioning of MetaTrader 4 - a trading terminal developed by MetaQuotes Software Corp. and used across markets such as Forex, Futures, and CFD. An .ex4 file contains compiled MQL4 bytecode, the binary output produced when MQL4 source code is built within MetaEditor, the IDE bundled with the terminal.
.ex4 files can contain three distinct types of programs: indicators, scripts, and Expert Advisors. An Expert Advisor is a kind of automated bot used for automatization of trading and analytical processes, capable of placing and managing orders without manual intervention.
Compiling and decompiling .ex4 files
.ex4 files contain executable bytecode compiled from .mq4 source files. The internal binary format is proprietary to MetaQuotes and changed substantially with MT4 build 600 (February 2014), so files compiled before that build may not load on current terminals. This process can be reversed - it is technically possible to decompile .ex4 files back toward their original MQL4 source using third-party decompilers, though the result is rarely an exact replica of the original code.
How to open an .ex4 file
Installing MetaTrader 4 is not enough to use an .ex4 file. Depending on its content, it first needs to be placed in the correct folder within the terminal's MQL4 data directory:
- If an
.ex4file contains an indicator, place it in theMQL4\Indicators\folder. - If a file contains a script, place it in the
MQL4\Scripts\folder. - If a file contains an Expert Advisor, place it in the
MQL4\Experts\folder.
After placing the file, refresh the Navigator panel in MetaTrader 4 (press F5 or restart the terminal). The MetaTrader 5 successor to this format is .ex5, compiled from .mq5 source code.
Security & safety
RISK: HIGHAn .ex4 is executable trading code that runs with access to your trading account inside MT4. A malicious or careless EA can place losing trades, drain a live account, or (rarely) abuse DLL/web calls. Risk checklist: only run .ex4 files from a trusted source/seller, test on a DEMO account first, keep "Allow DLL imports" off unless the author requires it and you trust them, and be highly suspicious of "free EA" and "ex4 decompiler" downloads - they are a common malware vector. Never run an unsolicited .ex4.
Format details
in a nutshellPrograms that open EX4 files
Technical details
deep spec| Developer | MetaQuotes Software Corp. |
| Platform compatibility | MetaTrader 4 (MT4) terminal only; not loadable in MetaTrader 5 |
| Bytecode type | Compiled MQL4 bytecode; not a native Windows or OS executable |
| Source language | MQL4 (MetaQuotes Language 4), a C++-like proprietary scripting language |
| Compiler / IDE | MetaEditor, bundled with the MetaTrader 4 terminal |
| Program types | Expert Advisor (EA), Custom Indicator, Script - one program type per file |
| Expert Advisor folder | MQL4\Experts\ |
| Indicator folder | MQL4\Indicators\ |
| Script folder | MQL4\Scripts\ |
| Format revision | Internal binary format changed substantially in MT4 build 600 (February 2014); .ex4 files compiled before that build may not run on current terminals |
| MIME type | application/octet-stream |
| Magic bytes | No stable publicly documented file signature; files are identified by their folder location within the MT4 data directory |
| Format nature | Proprietary closed binary format; no public specification |
| Successor format | .ex5 (MetaTrader 5 compiled program, compiled from .mq5 source) |
| Supported markets | Forex currency pairs, CFD, Futures, and Stocks via broker integration |
| Released | 2005 (MetaTrader 4 platform) |
| Specification | www.mql5.com |
EX4 conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about EX4 files.