EX4 to MQ4 Decompiler: Complete Guide to Recovering MQL4 Source Code in September 2026
EX4 to MQ4 Decompiler: Complete Guide to Recovering MQL4 Source Code in September 2026
If you have an EX4 file but have lost the original MQ4 source code, you may be searching for an EX4 to MQ4 decompiler or an MT4 source-code recovery service.
This is a common problem with older MetaTrader 4 Expert Advisors, custom indicators, scripts, and other MQL4 applications. The compiled EX4 may still work inside MetaTrader 4, while the editable MQ4 source file may have been deleted, lost, damaged, or never provided.
However, EX4 to MQ4 recovery is not the same as a normal file conversion.
The normal MQL4 development process starts with source code and produces a compiled EX4:
MQ4 source code → MetaEditor/compiler → EX4
Source-code recovery attempts to work in the opposite direction:
EX4 → analysis → reconstruction → MQ4-like source
The amount of information that can be reconstructed depends on the individual file and its technical characteristics.
This September 2026 guide explains the difference between EX4 and MQ4, how source-code recovery works, what affects recovery, how to evaluate a decompiler or recovery service, how to test recovered MQL4 code, and what you should know before attempting the process.
What Is an EX4 File?
An EX4 file is a compiled program used by MetaTrader 4.
EX4 files can represent:
- Expert Advisors
- Custom indicators
- Scripts
- Other compiled MQL4 applications
An EX4 normally originates from MQL4 source code.
For example:
MyExpertAdvisor.mq4
may be compiled into:
MyExpertAdvisor.ex4
The MQ4 is the source file used for development, while the EX4 is the compiled application used by the MT4 terminal.
MetaQuotes documents MQL4 source and compiled EX4 files as part of the MT4 program structure. (MQL5)
What Is an MQ4 File?
An MQ4 file contains MQL4 source code.
Depending on the application, it can contain:
- Functions
- Variables
- Trading logic
- Entry conditions
- Exit conditions
- Indicator calculations
- Risk-management rules
- User inputs
- Alerts
- Chart objects
- Order-management logic
- External calls
- Program settings
Because MQ4 is source code, developers can normally open it in MetaEditor, modify it, compile it, and produce a new EX4.
This is why losing the MQ4 source can create a significant maintenance problem.
EX4 vs. MQ4
|
Characteristic |
MQ4 |
EX4 |
|
File type |
Source code |
Compiled application |
|
Typical extension |
.mq4 |
.ex4 |
|
Designed for editing |
Yes |
No |
|
Used by MT4 |
After compilation |
Yes |
|
Contains developer source text |
Yes |
Compiled representation |
|
Can be normally modified in MetaEditor |
Yes |
No |
One important point is that changing the file extension does not perform source-code recovery.
For example:
example.ex4 → example.mq4
does not transform the compiled program into MQL4 source code.
What Is an EX4 to MQ4 Decompiler?
An EX4 to MQ4 decompiler is a tool or service intended to analyze a compiled EX4 program and reconstruct source-code-level information.
The term “decompiler” is commonly used because the process attempts to move from compiled code toward a higher-level representation.
However, it is useful to distinguish decompilation from ordinary conversion.
A file converter generally changes data from one format into another while retaining the information contained in the original file.
Decompilation is different.
Compilation can involve irreversible loss of source-level information. Modern binary-decompilation research also notes that reconstructed code can suffer from semantic loss and may not reproduce the original source exactly. (arXiv)
For that reason, an EX4-to-MQ4 project is better viewed as source-code recovery or reconstruction rather than guaranteed restoration of the original MQ4 file.
Why Recover MQL4 Source Code?
There are several legitimate reasons to investigate EX4 source recovery.
1. The Original MQ4 Was Deleted
You may still have the EX4 but have accidentally deleted the source.
2. A Computer Failed
A hard-drive failure or damaged development computer can result in the loss of the MQ4 project.
3. The Developer Is No Longer Available
A company may have an old Expert Advisor created by a former employee or contractor but no longer have access to the development files.
4. An Old EA Needs Modification
You may need to change:
- Entry rules
- Exit rules
- Stop-loss calculations
- Take-profit calculations
- Risk management
- Position sizing
- Trading sessions
- Alerts
- Filters
Without source code, normal modification is difficult.
5. A Custom Indicator Needs Maintenance
An indicator may still work but require additional features or technical maintenance.
6. A Legacy Project Needs to Be Preserved
Businesses sometimes need to recover source code from old trading software so that the project can continue to be maintained.
How EX4 to MQ4 Recovery Works
The exact process varies between tools, but the general workflow can be understood in several stages.
Step 1: Preserve the Original EX4
Before attempting anything, create a backup.
Keep the untouched original file.
For example:
Original_EA.ex4
Then create a separate working copy.
This is especially important if the EX4 is the only remaining copy of the application.
Step 2: Identify the MT4 Environment
Try to determine:
- Approximate EX4 age
- MT4 build
- Whether the EX4 still runs
- Whether it is an EA, indicator, or script
- Whether supporting files exist
- Whether the software uses DLLs or libraries
MT4’s history is important here.
MetaQuotes introduced a major MQL4 and terminal update with Build 600 in 2014, including changes to the MQL4 language, compiler, program storage structure, and development environment. (MQL5)
That historical difference is one reason an EX4 should be evaluated individually rather than assuming that one recovery method works for every file.
Step 3: Locate Supporting Files
Do not look only for the EX4.
Check for:
- MQ4 files
- MQH files
- EX4 libraries
- DLLs
- Preset files
- Configuration files
- Custom indicators
- Documentation
MetaQuotes’ MT4 documentation describes separate directories for Experts, Indicators, Scripts, Include files, Libraries, Files, Presets, and other MQL4 resources. (MQL5)
A missing dependency can make an otherwise recoverable project much harder to reproduce and test.
Step 4: Analyze the EX4
A recovery process analyzes the compiled file to identify information that may be reconstructed.
Depending on the file, this may involve examining:
- Program structures
- Functions
- Variables
- Calculations
- Inputs
- Control flow
- Trading operations
- Indicator logic
- Internal relationships
The available information varies from one EX4 to another.
Step 5: Reconstruct MQL4 Source
The recovery system may then attempt to produce MQL4 source-like code.
The result might be:
Recovered_EA.mq4
But the recovered file should not automatically be assumed to be an exact copy of the original developer’s MQ4.
The purpose is to obtain usable source-level information that can potentially be reviewed, repaired, compiled, and tested.
Why Recovered MQ4 May Differ From the Original
One of the biggest misconceptions about EX4 decompilation is that the original source will necessarily reappear exactly as it was written.
That is not something you should assume.
The original MQ4 might have contained:
- Comments
- Meaningful variable names
- Specific formatting
- Developer notes
- Source organization
- Include files
- Project structure
Some of this information may not be available in the compiled representation.
Therefore, recovered code can look substantially different from the original source while still containing useful information.
Can Every EX4 Be Recovered?
There is no universal answer.
The outcome depends on the individual file.
Factors that may affect a recovery attempt include:
EX4 generation
Older and newer MT4 compiler generations may have different characteristics.
Protection
Protection or other measures can affect what information can be reconstructed.
File condition
A damaged or incomplete file can create additional difficulties.
Program complexity
A small script and a large Expert Advisor are very different recovery problems.
External dependencies
DLLs, libraries, include files, and other resources may be required.
Compilation history
The environment that produced the EX4 can affect the available information.
Therefore, claims that every EX4 can be restored into the exact original MQ4 should be treated cautiously.
The Importance of MT4 Build History
MT4 Build 600 was a major transition point.
MetaQuotes stated that Build 600 introduced a revised MQL4 language and a new development environment, including features such as classes, structures, inheritance, the Standard Library, debugging, profiling, and a revised file structure. (MQL5)
MetaQuotes also documented that old EX4 applications could continue running in newer terminals under the compatibility arrangements described at the time, while source projects and compilation requirements could differ. (MQL5)
For an EX4 recovery project, this historical information matters because the file’s age and compilation environment can provide useful context.
EX4 to MQ4 for Expert Advisors
Expert Advisors are one of the most common types of EX4 software.
An EA can contain:
- Entry strategies
- Exit strategies
- Stop-loss logic
- Take-profit logic
- Trailing stops
- Position sizing
- Risk controls
- Trading-session filters
- Spread filters
- Indicator calculations
- Order management
- Alerts
After source recovery, each of these areas may need to be tested.
The important question is not simply:
“Did I receive an MQ4 file?”
The more useful question is:
“Does the recovered source compile and behave consistently with the original EX4?”
EX4 to MQ4 for Custom Indicators
Custom indicators can also exist as EX4 files.
They may contain:
- Indicator buffers
- Mathematical calculations
- Moving averages
- Oscillators
- Signals
- Alerts
- Chart objects
- Custom formulas
If the original EX4 still functions, its behavior can be used as a reference when testing recovered source code.
EX4 to MQ4 for Scripts
MT4 scripts are another category of compiled MQL4 applications.
Scripts can automate individual operations such as:
- Order management
- Chart management
- Data processing
- Calculations
- Repetitive tasks
The same general recovery considerations apply.
What Information May Be Recoverable?
Depending on the EX4, a recovery process may potentially reconstruct source-like representations of:
- Functions
- Variables
- Conditions
- Calculations
- Inputs
- Trading operations
- Indicator calculations
- Program logic
- Event-handling structures
However, recoverability should always be assessed on the specific file.
What May Not Be Recovered Exactly?
Some source-level information may not be reproduced exactly.
Comments
Developer comments may not be available in the recovered source.
Formatting
Indentation and spacing may differ.
Variable names
Original descriptive names may not always be preserved.
Project organization
The original directory and development structure may need to be recreated manually.
External dependencies
DLLs, libraries, includes, and configuration files may remain separate requirements.
How to Test Recovered MQ4 Source Code
Testing is essential.
A practical process is:
1. Compile the source
Open the recovered MQ4 in MetaEditor.
Check for:
- Syntax errors
- Undefined variables
- Missing functions
- Missing includes
- Library errors
2. Check inputs
Compare the available parameters with the original EX4.
3. Backtest
Where appropriate, run historical tests.
4. Compare against the original EX4
If the original still runs, compare both versions under controlled conditions.
5. Use a demo account
Test the recovered version before considering live deployment.
6. Monitor logs
Review MT4’s Experts and Journal information for unexpected errors.
Comparing EX4 and Recovered MQ4 Behavior
If you still have the original EX4, it can serve as a reference implementation.
Useful comparison points include:
- Entry timing
- Exit timing
- Stop-loss placement
- Take-profit placement
- Lot calculations
- Indicator signals
- Trading-session rules
- Spread filters
- Order management
- Alerts
The goal is behavioral validation rather than visual similarity between the original and recovered source.
Common EX4 to MQ4 Problems
“The EX4 cannot be processed.”
The file may have characteristics that the particular recovery method does not support.
“The MQ4 does not compile.”
The reconstructed source may require additional repair.
“The code looks different.”
This can occur because reconstructed source is not necessarily the original developer’s source text.
“The EA behaves differently.”
Further debugging and behavioral comparison may be required.
“A DLL is missing.”
The EX4 may depend on an external component that was not included with the file.
“The original source had more files.”
The EX4 may have depended on MQH includes, libraries, indicators, resources, or other project files.
EX4 Decompiler vs. EA Rebuild
Source recovery is not the only possible solution.
Suppose you have:
- An EX4
- Trading rules
- Screenshots
- Input settings
- Documentation
- Trading history
- Strategy specifications
A developer may be able to rebuild the required functionality as a new MQL4 project.
That is not the same as recovering the original source, but it can sometimes solve the underlying maintenance problem.
The distinction should be made clear:
Source recovery: attempts to reconstruct the original program’s source-level logic.
Rebuild: creates new source code based on available information about the program’s behavior.
How to Choose an EX4 to MQ4 Decompiler
Before selecting a recovery tool or service, ask several questions.
Does the provider inspect the file first?
A file-specific assessment is more useful than a generic promise.
Does it support the relevant EX4 generation?
Give the provider information about the MT4 environment if available.
What exactly will you receive?
Ask whether the result is:
- Recovered MQ4
- Reconstructed source
- Partially recovered code
- Rebuilt source
- Source plus testing
Will the source compile?
This is an important distinction.
A file with an .mq4 extension is not necessarily usable MQL4 source.
Is functional testing included?
Ask whether the recovered source can be tested against the original EX4.
How are files handled?
If the EA contains proprietary trading logic, understand how your uploaded files are stored, accessed, and protected.
What to Do Before Paying for Recovery
Before using a paid EX4 recovery service, search for the original source code.
Check:
- Old computers
- VPS backups
- External drives
- USB drives
- Cloud storage
- Email attachments
- ZIP archives
- Git repositories
- Developer backups
- Old project folders
Search for both .mq4 and .mqh files.
Also search for the EA’s name and project name.
The original source is generally preferable to reconstructed source if it can be found.
Preserve the EX4 Before Recovery
Always make a backup of the original EX4.
A simple structure could be:
MT4-Recovery/
├── Original/
│ └── MyEA.ex4
├── Working/
└── Recovered/
Never rely on the only remaining copy of an important EX4.
If the file is commercially valuable, maintain multiple backups.
Legal and Ownership Considerations
Before attempting to recover source code, make sure you have the appropriate rights or authorization.
There is an important difference between:
- Recovering your own lost source code
- Recovering software for a business that owns it
- Recovering software with explicit authorization
- Attempting to extract source code from someone else’s commercial product
Licensing agreements, copyright, contracts, and applicable laws can affect what is permitted.
Technical access to an EX4 does not automatically establish legal permission to reverse engineer or modify it.
How to Protect Recovered MQ4 Source Code
Once source code has been recovered, avoid repeating the original problem.
Create several backups.
A practical strategy can include:
Local development copy
Keep the active project on your development machine.
Cloud backup
Maintain a secure cloud copy.
Offline backup
Keep another copy on offline storage.
Version control
For active development projects, use version control so changes can be tracked over time.
Also preserve:
- MQ4 files
- MQH files
- DLLs
- Libraries
- Presets
- Documentation
- Configuration files
- Version information
EX4 to MQ4 Recovery Checklist
Before starting, use this checklist:
☐ Search for the original MQ4
☐ Search for MQH include files
☐ Back up the EX4
☐ Identify the MT4 build
☐ Determine whether the EX4 still runs
☐ Identify the program type
☐ Collect DLLs and libraries
☐ Check ownership and authorization
☐ Assess the individual EX4
☐ Attempt recovery or reconstruction
☐ Compile the recovered MQ4
☐ Test the source
☐ Compare it with the original EX4
☐ Back up the recovered project
Frequently Asked Questions
What is an EX4 to MQ4 decompiler?
An EX4-to-MQ4 decompiler is a tool or service intended to analyze a compiled MetaTrader 4 EX4 application and reconstruct source-code-level MQL4 information.
Can I rename EX4 to MQ4?
No. Renaming the extension does not convert compiled EX4 data into MQL4 source code.
Can every EX4 be converted to MQ4?
No. Recovery depends on the characteristics of the individual EX4 and may be limited by compilation history, protection, file condition, dependencies, and other factors.
Will recovered MQ4 be identical to the original?
Not necessarily. Source-level information such as comments, formatting, names, and project organization may not be reproduced exactly.
Can recovered MQ4 be compiled?
It may be possible, but compilation errors or missing dependencies can require additional repair.
Can an EX4 Expert Advisor be recovered?
Some EX4 files may provide useful information for source reconstruction, while others may present significant technical limitations. An individual assessment is appropriate.
What if my EA uses DLLs?
The DLLs and other dependencies may be necessary for complete testing and reproduction of the application’s functionality.
Can I modify an EX4 without MQ4?
Normal source-level modification requires source code. If the original MQ4 is unavailable, recovery or a new implementation may be considered.
Should recovered trading software be used immediately on a live account?
No. Recovered code should be compiled, tested, and compared with the original behavior before being considered for live deployment.
Final Thoughts
An EX4 to MQ4 decompiler can be relevant when the original MQL4 source code has been lost but the compiled EX4 remains.
However, the process should be approached realistically.
It is not simply a matter of changing .ex4 to .mq4. The objective is to analyze compiled software and reconstruct usable source-level information.
The best workflow is:
Find the original MQ4 → preserve the EX4 → identify the MT4 environment → collect dependencies → assess the file → recover or reconstruct source → compile → test → compare behavior → back up the project.
The most important measure of success is not whether an .mq4 file is produced.
The important questions are:
Does the recovered source compile?
Can it be maintained?
Does it reproduce the required functionality?
Can it be safely tested and developed further?
For September 2026, those are the key considerations anyone researching EX4 to MQ4 decompilation and MQL4 source-code recovery should understand.