If you intend to distribute your EX4 without giving away your source code:
For traders: Never run an EX4 file from an untrusted source – compiled code can hide malicious actions (e.g., sending your trades or account details elsewhere). Stick to reputable marketplaces or developers.
For developers: Always keep your original MQ4 files safely backed up. The EX4 is for distribution; the MQ4 is your master copy.
MetaTrader 4 and MQL4 are trademarks of MetaQuotes Ltd. This article is for educational purposes only.
Converting MQ4 to EX4 is the process of "compiling" human-readable source code into a machine-readable executable file that the MetaTrader 4 (MT4) platform can run. Core Definitions
MQ4 (.mq4): The source code file. It contains text-based instructions that you can open, read, and edit in MetaEditor.
EX4 (.ex4): The executable file. This is the compiled version that actually performs the trading or technical analysis on your charts. You cannot edit this file directly. 🛠️ Step-by-Step Conversion Guide Method 1: Manual Compilation (Recommended) mq4 to ex4
This is the standard way to convert a file if you want to check for errors.
Open MetaEditor: Inside MT4, click the Yellow Diamond icon or press F4.
Open your MQ4 file: In the "Navigator" pane (on the left), find your .mq4 file. Double-click it to see the code. Compile: Click the Compile button at the top or press F5. Check Output: Look at the "Errors" tab at the bottom.
If it says "0 errors," your .ex4 file is automatically created in the same folder.
If there are errors, the conversion will fail until the code is fixed. Method 2: Automatic Compilation MetaTrader 4 can sometimes handle the conversion for you. Metatrader User Guide - Forex trading
Here is the essential technical and practical content regarding converting MQ4 (source code) to EX4 (compiled executable) in MetaTrader 4. If you intend to distribute your EX4 without
Warning: Some online tools or software claim to "convert MQ4 to EX4" without source code. Many are scams or malware. Others are decompilers that attempt to reverse engineer EX4 back to MQ4—a practice that violates most software licenses and MetaQuotes’ terms of service.
If you lose your original MQ4 file and only have an EX4, you cannot legitimately convert it back. Always keep backups of your source code.
An MQ4 file is the human-readable source code written in the MQL4 programming language. Think of it as a text document containing the logic, conditions, and calculations that define how your trading tool behaves.
Subject: Need help converting .mq4 to .ex4 file
Body: Hi everyone,
I have a custom indicator/expert advisor that I need to compile from source (.mq4) to an executable file (.ex4). I am currently running into build errors on my MetaEditor and I am not sure how to fix them. MetaTrader 4 and MQL4 are trademarks of MetaQuotes Ltd
Is there anyone here who would be willing to take a look or compile it for me?
File Attached: [YourFileName].mq4
Thanks in advance!
A common query related to "MQ4 to EX4" is the reverse process: EX4 to MQ4.
If you have an EX4 file but lost the source code (MQ4), you essentially cannot edit or fix the logic. You would typically need to hire a programmer to rewrite the code from scratch based on observed behavior.