Blog Details

thumb
12 Nov 2026

EX4 Decompiler: The Complete Beginner’s Guide to EX4 Files, MQ4 Source Code and Expert Advisors

EX4 Decompiler: The Complete Beginner’s Guide to EX4 Files, MQ4 Source Code and Expert Advisors

Meta Description: Learn what EX4 and MQ4 files are, how MT4 Expert Advisors work, and what beginners should know about EX4 decompilation and source code recovery.

Introduction

If you use MetaTrader 4 (MT4), you may have come across files ending in .EX4 and .MQ4. Both are important to automated trading, but they serve different purposes.

An MQ4 file contains the source code used to develop an MT4 trading application. An EX4 file is the compiled version that MetaTrader 4 can execute. Understanding the difference is important if you want to modify an Expert Advisor, troubleshoot a trading tool, or recover source code from an existing EX4 file.

This beginner-friendly guide explains EX4 files, MQ4 source code, Expert Advisors, and how an EX4 decompiler service may help when the original source code is unavailable.

1. What Is an EX4 File?

An EX4 file is an executable file created when an MQL4 source-code program is compiled using MetaEditor.

It is used by MetaTrader 4 to run automated trading applications, including Expert Advisors, custom indicators, and scripts.

Unlike an MQ4 file, an EX4 file does not contain source code in a normal, human-readable format. Its compiled structure is designed for execution by the trading platform.

Common characteristics of EX4 files:

  • Used by MetaTrader 4.
  • Generated by compiling MQL4 source code.
  • Can run compatible trading applications.
  • Does not normally allow direct source-code editing.
  • Can be distributed without sharing the original source code.

MetaQuotes explains that compilation creates an executable file while hiding the original program algorithm. https://www.metatrader5.com/en/metaeditor/help/development/compile

2. What Is an MQ4 File?

An MQ4 file is the editable source-code file used to develop applications for MetaTrader 4.

Developers write instructions in MQL4, the programming language used to create MT4 trading tools. These instructions determine how an Expert Advisor or indicator behaves.

With the original MQ4 file, a developer can:

  • Review the trading strategy’s programming logic.
  • Modify entry and exit conditions.
  • Change risk-management settings.
  • Add or remove trading functions.
  • Fix programming errors.
  • Compile an updated EX4 file.

The main advantage of MQ4 is that it allows developers to work directly with the program’s source code.

3. EX4 vs MQ4: What Is the Difference?

Although both file formats are connected to MT4 applications, their purposes are different.

Feature

EX4

MQ4

File type

Compiled executable

Source code

Human-readable

Generally no

Yes

Editable in MetaEditor

Not directly

Yes

Used by MT4

Yes

Compiled first

Contains original source formatting

No

Yes

Suitable for code modifications

Requires source recovery or original source

Yes

In simple terms, MQ4 is the development file, while EX4 is the compiled application that MetaTrader 4 executes.

4. What Is an EX4 Decompiler?

An EX4 decompiler is a specialised tool or service intended to analyse compiled EX4 files and attempt to reconstruct source code from them.

This can be useful when someone has an EX4 file but no longer has access to the original MQ4 source code.

For example, a trader may have purchased an Expert Advisor several years ago and lost contact with its original developer. If the trader owns the file or has permission to analyse it, source-code recovery may help make further technical work possible.

However, it is important to understand that EX4 decompilation is not the same as ordinary file conversion.

Source-code recovery has limitations:

  • Results depend on the file’s structure and compiler generation.
  • Original comments and formatting may not be recoverable.
  • Variable and function names may not match the original.
  • Some program logic may be difficult or impossible to reconstruct.
  • Not every EX4 file can be successfully recovered.

A recovered MQ4 file should therefore be reviewed, tested, and checked before being used in a live trading environment.

5. What Are Expert Advisors in MetaTrader 4?

An Expert Advisor, commonly called an EA, is an automated trading program written in MQL4.

An EA can analyse market information, identify trading conditions, and perform automated trading operations according to its programmed rules.

Depending on its design, an Expert Advisor may:

  • Open and close trades.
  • Calculate position sizes.
  • Apply stop-loss and take-profit levels.
  • Monitor market conditions.
  • Manage existing positions.
  • Follow predefined trading strategies.

Expert Advisors are stored in the MT4 MQL4/Experts directory. MetaTrader’s official documentation explains how they are created and used. https://www.metatrader4.com/en/trading-platform/help/autotrading/experts

6. Why Would Someone Need MQ4 Source Code?

There are several reasons why a trader or developer may need access to the source code of an existing MT4 application.

Modifying an Expert Advisor

If you want to change how an EA operates, you generally need its source code. This allows a developer to inspect and modify the relevant programming instructions.

Updating an Older Trading Application

Older trading tools may require technical maintenance or compatibility checks. Having the source code can make it easier to investigate and update the application.

Fixing Programming Errors

An EA may behave differently from what its owner expects. Source code can help a developer investigate the logic and identify potential programming issues.

Understanding an Existing Trading Tool

A trader may want to understand how a particular application is structured before commissioning further development. Any analysis should respect the developer’s intellectual property and applicable licence terms.

Recovering Lost Source Code

If the original MQ4 file has been lost, a recovery assessment may help determine whether useful source code can be reconstructed from the available EX4 file.

7. Can You Convert EX4 to MQ4 Online?

Many people search for an online EX4 to MQ4 converter because they want a quick way to obtain editable source code.

However, EX4-to-MQ4 recovery is not a straightforward format conversion.

An EX4 file is compiled, and the original source code is not simply stored inside it in a form that can be extracted like a normal document.

Some online tools may advertise free EX4 conversion, but users should be cautious about uploading valuable or confidential trading files to unknown websites.

Before choosing a service, consider:

  • Whether the provider explains the limitations of recovery.
  • How your files are handled and protected.
  • Whether the provider has relevant technical experience.
  • Whether the service is authorised to analyse your file.
  • Whether the recovered code will be reviewed and tested.

8. How Does Professional EX4 Source Code Recovery Work?

A professional recovery process should begin with an assessment rather than an automatic promise of success.

A typical process may include:

Step 1: Submit the EX4 file

Provide the EX4 file you own or are authorised to have analysed.

Step 2: Technical assessment

The file is examined to determine its characteristics and whether source-code recovery appears technically feasible.

Step 3: Recovery attempt

If the file is suitable, a recovery process is attempted.

Step 4: Source-code review

The reconstructed MQ4 output is checked for its structure and potential issues.

Step 5: Delivery

The available recovered source code is delivered, with any known limitations explained.

Turnaround depends on the file’s complexity and technical condition. Some projects may be completed within 1–4 hours, while others require more time.

9. How to Open MQ4 and EX4 Files in MetaTrader 4

If you have an MQ4 file, you can open it using MetaEditor.

Follow these steps:

  1. Open MetaTrader 4.
  2. Press F4 to launch MetaEditor.
  3. Locate the relevant MQ4 file.
  4. Open it in the editor.
  5. Review or modify the source code.
  6. Compile it if you want to generate an updated EX4 file.

For an EX4 file, place it in the appropriate MT4 folder, such as MQL4/Experts for an Expert Advisor, then refresh the Navigator window.

Remember that an EX4 file is intended to run in MT4, not to be edited directly as ordinary source code.

10. Important Things to Know Before Using an EX4 Decompiler

Before requesting source-code recovery, keep these points in mind:

  • Ownership matters: Only submit files you own or have permission to analyse.
  • Recovery is not guaranteed: Some compiled files may not produce usable source code.
  • The output may differ: Reconstructed code may not preserve the original comments, names, or formatting.
  • Testing is essential: Never assume recovered code behaves exactly like the original application.
  • Protect your files: Use a provider with clear confidentiality and file-handling practices.

These precautions help you make a more informed decision before starting a recovery project.

Frequently Asked Questions

1. What is the difference between EX4 and MQ4?

MQ4 is the editable MQL4 source-code file, while EX4 is the compiled executable file used by MetaTrader 4.

2. Can I edit an EX4 file directly?

No, not in the same way you edit an MQ4 file. You generally need the original source code or a suitable source-code recovery process before making code-level modifications.

3. Can every EX4 file be decompiled?

No. Recovery depends on several technical factors, and some EX4 files may not produce usable reconstructed source code.

4. What is an Expert Advisor?

An Expert Advisor is an automated trading application for MetaTrader 4. It follows programmed instructions to analyse markets and, where configured, manage trades.

5. Does an EX4 decompiler restore the original MQ4 exactly?

Not necessarily. Reconstructed source code may differ from the original in formatting, comments, variable names, and other details.

6. How long does EX4 decompilation take?

The time depends on the file’s complexity and technical condition. Some projects may be completed within 1–4 hours, while others take longer.

7. Can recovered MQ4 source code be compiled again?

It may be possible if the recovered code is sufficiently complete and compatible with the compiler. It may also require corrections or additional development work.

8. Is EX4 decompilation legal?

It depends on ownership, licensing terms, permissions, and applicable laws. You should only request analysis of files you own or are authorised to examine.

Conclusion

Understanding the difference between EX4 and MQ4 files is an important first step for anyone working with MetaTrader 4.

EX4 files allow MT4 applications to run, while MQ4 files provide editable source code for development and maintenance. When the original source code is unavailable, an EX4 decompiler service may offer a possible route to source-code recovery, although results are never guaranteed.

If you need help assessing an EX4 file, choose a professional service that explains the technical limitations, protects your files, and provides a clear assessment before starting.

Need help with an EX4 file?

Our EX4 decompiler service provides professional assistance with MT4 source-code recovery. Contact us to submit your file for assessment and discuss the available options.