Blog Details

thumb
03 Sep 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

Slug: /ex4-decompiler-the-complete-beginners-guide-to-ex4-files-mq4-source-code-and-expert-advisors

If you are new to MetaTrader 4 and have come across files such as EX4, MQ4, or MQH, you may be wondering what they mean and why traders and developers sometimes search for an EX4 decompiler.

Understanding the difference between compiled EX4 programs and editable MQ4 source code is important, especially if you have an old MetaTrader 4 Expert Advisor or indicator and no longer have access to its original source code.

In this beginner’s guide, we explain what EX4 files are, what MQ4 source code is, how Expert Advisors and indicators use these files, and what you should know about EX4 to MQ4 source-code recovery.

What Is an EX4 File?

An EX4 file is a compiled program used by MetaTrader 4.

MQL4 programs are normally written as source code and saved with the .mq4 extension. After the source code is compiled, an executable EX4 file is produced for use in MetaTrader 4.

For example:

MyEA.mq4 → MyEA.ex4

The MQ4 file is intended for development and editing, while the EX4 file is the compiled version used by the MT4 terminal.

What Is MQ4 Source Code?

MQ4 is the source-code format associated with MQL4, the programming language used to create applications for MetaTrader 4.

Developers can use MQ4 source files to create and modify:

  • Expert Advisors
  • Custom indicators
  • Scripts
  • Other MQL4 applications

The source code can be edited using the appropriate MQL4 development tools and then compiled into an EX4 program.

This is why losing an MQ4 file can be a problem for a developer.

You may still have the EX4 file, but you no longer have the editable project that was used to create it.

EX4 vs MQ4: What Is the Difference?

The easiest way to understand the difference is:

File

Purpose

MQ4

MQL4 source code

EX4

Compiled MT4 program

MQH

MQL4 include/source file

An MQ4 file can be edited and compiled into an EX4 file. An EX4 file is intended for execution inside MetaTrader 4 rather than normal source-code editing.

What Is an Expert Advisor?

An Expert Advisor (EA) is an automated trading program designed for MetaTrader.

An EA can be programmed to perform actions according to predefined trading rules. Depending on its design, it may analyze market conditions, generate signals, manage positions, and execute trading operations.

Expert Advisors are one of the main types of MQL4 applications that can exist as EX4 programs.

For example, an EA might contain logic for:

  • Entry conditions
  • Exit conditions
  • Stop-loss management
  • Take-profit management
  • Position sizing
  • Trading-session restrictions
  • Technical indicators
  • Alerts
  • Trade management

The actual functionality depends on how the EA was programmed.

What Is an MT4 Custom Indicator?

A custom indicator is another type of MQL4 application.

Unlike an Expert Advisor, an indicator is generally designed to analyze market data and display information on a chart rather than automatically placing and managing trades.

Examples can include custom:

  • Moving-average indicators
  • Trend indicators
  • Oscillators
  • Signal indicators
  • Histogram indicators
  • Support and resistance tools

Custom indicators can also be compiled into EX4 files for use inside MetaTrader 4.

What Is an EX4 Decompiler?

An EX4 decompiler refers to software or a technical service intended to analyze compiled EX4 programs and attempt to recover usable source-code information.

The goal may be to recover or reconstruct MQL4 source code from an EX4 file.

However, it is important to understand that EX4 decompilation is not necessarily a simple one-click conversion.

Different EX4 files can have different technical characteristics, and complete recovery of the original source code cannot be guaranteed for every file.

Can You Convert EX4 to MQ4?

You cannot convert an EX4 file into the original MQ4 source simply by changing the file extension.

For example:

MyIndicator.ex4

cannot become editable source code simply by renaming it:

MyIndicator.mq4

The EX4 file is a compiled program, whereas MQ4 is source code.

A technical recovery process is required if the goal is to recover usable source information.

Why Would Someone Need EX4 to MQ4 Source-Code Recovery?

There are several legitimate reasons.

Lost Source Code

A developer may accidentally lose an original MQ4 project while still having the compiled EX4 version.

Old Computer or Backup

An older MT4 project may have been stored on a computer or backup that is no longer accessible.

Legacy Projects

Businesses and developers may still have older MT4 programs that require maintenance or further development.

Authorized Modifications

A user may have authorization to maintain or modify an existing MT4 program but no longer have the original source files.

Technical Analysis

In some situations, analyzing an EX4 file can help determine how an existing authorized program works.

Can Every EX4 File Be Decompiled?

No.

This is an important point for beginners.

The possibility of recovering usable source code depends on the individual EX4 file.

Factors that may affect the process include:

  • Compilation characteristics
  • MT4 build
  • File integrity
  • Program complexity
  • Protection mechanisms
  • Encryption
  • External dependencies
  • Available source information

Some files may be more difficult to analyze than others.

Therefore, a professional service should assess the specific file rather than automatically promising a perfect conversion.

Why Might an EX4 Decompiler Produce Different Code?

Even when source-code recovery is technically possible, the recovered MQ4 may not be identical to the original developer’s source.

The original source may have contained:

  • Comments
  • Meaningful variable names
  • Developer notes
  • Formatting
  • Original project organization
  • Documentation

Some of this information may not survive compilation in a form that can be restored.

As a result, recovered source code may require additional cleanup or reconstruction.

What Is EX4 Source-Code Recovery?

EX4 source-code recovery is a broader description of the process of analyzing a compiled EX4 file and attempting to reconstruct usable source-code information.

The process can involve:

  1. Examining the EX4 file
  2. Identifying its characteristics
  3. Assessing recovery possibilities
  4. Recovering available source information
  5. Reconstructing or organizing the code
  6. Reviewing the resulting MQ4
  7. Testing the recovered program

The exact process depends on the file.

EX4 Decompiler for Expert Advisors

If your EX4 file is an Expert Advisor, the recovery process can be more complex because an EA may contain substantial trading logic.

A complex EA could include multiple components and dependencies.

After source-code recovery, the resulting MQ4 should be reviewed carefully before being compiled or used in a live trading environment.

Testing is especially important when the program can execute trades.

EX4 Decompiler for MT4 Indicators

Custom indicators can also be distributed as EX4 files.

If you have an authorized EX4 indicator but no longer have its MQ4 source, an EX4 analysis and source-code recovery service may help determine whether usable source information can be recovered.

As with Expert Advisors, the final result can depend heavily on the individual file.

Where Are EX4 and MQ4 Files Stored in MT4?

Modern MetaTrader 4 installations use an MQL4 data structure containing separate directories for Expert Advisors, indicators, scripts, libraries, and other files. MetaQuotes documents locations such as MQL4\Experts, MQL4\Indicators, MQL4\Scripts, and MQL4\Libraries.

You can access the relevant MT4 data directory through the terminal’s File → Open Data Folder option.

The exact location on your computer can vary depending on your MT4 installation.

What Happens When an MQ4 File Is Compiled?

The basic process is:

MQL4 source code → compiler → EX4 program

The developer works with the MQ4 source code and compiles it into a program that MetaTrader 4 can execute.

This compiled EX4 file is what users commonly place in the appropriate MT4 application directory and load through the platform.

Why Should You Keep Your MQ4 Source Code?

If you are an MQL4 developer, keeping your original MQ4 files securely backed up is extremely important.

Your source code allows you to:

  • Make future changes
  • Fix bugs
  • Add features
  • Update compatibility
  • Compile new EX4 versions
  • Maintain your Expert Advisor
  • Maintain your custom indicators

It is therefore good practice to keep multiple secure backups of important MQL4 projects.

How to Choose an EX4 Decompiler Service

If you are looking for an EX4 to MQ4 decompiler service, consider the following factors.

Experience

Look for a provider familiar with MetaTrader 4 and MQL4 applications.

File Assessment

A good service should assess your particular EX4 rather than making unrealistic promises about every file.

Transparent Expectations

Ask what type of source-code recovery is possible and whether the recovered code may require cleanup or reconstruction.

Confidentiality

If your EX4 file belongs to a private commercial project, consider how your files and information will be handled.

Clear Pricing

Make sure you understand what is included in the service and whether complex files require additional work.

How Much Does EX4 to MQ4 Recovery Cost?

There is no universal price.

The cost can depend on:

  • Number of files
  • Program complexity
  • Protection
  • Encryption
  • External dependencies
  • Required reconstruction
  • Code cleanup
  • Testing requirements

A professional provider may offer different packages depending on the complexity of the project.

How Long Does EX4 Decompilation Take?

Processing time varies.

A simple EX4 file may require less analysis than a complex Expert Advisor containing multiple components or dependencies.

The best way to estimate the workload is to assess the individual EX4 file before starting the project.

Is EX4 Decompilation Legal?

The legal and contractual position can depend on factors such as ownership, licensing terms, jurisdiction, and the purpose of the analysis.

You should only analyze, recover, modify, or reconstruct software when you have the necessary rights or authorization to do so.

If you obtained an EX4 from another developer or commercial marketplace, check the applicable license terms before attempting source-code recovery.

What Should You Send for an EX4 Assessment?

For an initial assessment, provide the original EX4 file.

If the program depends on additional files and you are authorized to share them, those may also be relevant.

Avoid modifying the original file before submitting it for analysis.

Frequently Asked Questions

What is an EX4 decompiler?

An EX4 decompiler is software or a technical service designed to analyze a compiled MetaTrader 4 EX4 program and attempt to recover usable MQL4 source-code information.

What is the difference between EX4 and MQ4?

MQ4 is the source-code format used for MQL4 development, while EX4 is the compiled format used by MetaTrader 4.

Can EX4 be converted directly to MQ4?

No. Renaming an EX4 file to MQ4 does not recover the source code. A technical source-code recovery process is required.

Can every EX4 file be decompiled?

No. Recovery results depend on the characteristics and condition of the individual EX4 file.

Can Expert Advisors be recovered from EX4?

An EX4 Expert Advisor can be assessed for potential source-code recovery, but the complexity and protection of the program can affect the result.

Can MT4 indicators be recovered from EX4?

An EX4 custom indicator can also be analyzed for potential source-code recovery, depending on the specific file.

Will recovered MQ4 be exactly the same as the original?

Not necessarily. Source-level information such as comments, formatting, and original names may not be recoverable.

Should recovered MQ4 code be tested?

Yes. Recovered source code should be reviewed and tested before being compiled or used in a live trading environment.

Final Thoughts

Understanding the difference between EX4 and MQ4 is the first step toward understanding EX4 decompilation.

MQ4 represents source code used in MQL4 development, while EX4 represents the compiled program used by MetaTrader 4.

If you have an EX4 file and legitimately need access to its source code for maintenance, analysis, or further development, an EX4 to MQ4 decompiler or professional source-code recovery service may be worth exploring.

However, every EX4 file is different. A proper assessment is the best way to determine what can realistically be recovered.

Have an EX4 file that needs analysis?

Get professional EX4 to MQ4 decompiler and MQL4 source-code recovery assistance and find out what options may be available for your MetaTrader 4 project.