What Is an EX4 File?

How to open, edit, & convert EX4 files

What to Know

  • An EX4 file is a MetaTrader 4 Program file.
  • Open one with MetaQuote's MetaTrader software.
  • Converting to EX5 or AFL might work with that same program.

This article explains what an EX4 file is, how to open one, and how to convert one to a different file format.

What Is an EX4 File?

A file with the EX4 file extension is a MetaTrader 4 Program file. It's compiled programming code made for the free foreign exchange market trading program called MetaTrader.

Stored in one of these files may be scripts or indicators used by that software. The file could instead be an Expert Advisor (EA) program used by MetaTrader for automating trading.

The programming code in the file is compiled from an MQ4 file, which is an MQL4 source code file. This is done through a tool called MetaEditor that comes installed with MetaTrader.

Screenshot of several EX4 files in Windows 10 that open with MetaTrader 5

EX4 files are used with MetaTrader 4, so EX5 files are very similar but are used by MetaTrader 5. MQH is another MetaTrader file format, called a MetaTrader Include file—you might see MQH files saved with EX4 and EX5 files.

Ext4 is a file system that has nothing at all to do with EX4 files.

How to Open an EX4 File

EX4 files can be opened with the free MetaTrader program from MetaQuotes. It works on Windows, macOS, and Linux.

If a double-click or double-tap on the file doesn't open it, try putting it in the right folder inside the MetaTrader program's installation directory. For example, if you're using MetaTrader 5, this folder is most likely here:

C:\Program Files\MetaTrader 5\MQL5

Once you're there, you'll notice several subfolders. You have to know what the EX4 file is, specifically, so you know where to put it. It can be an indicator, Expert Advisor (EA), or script—put the EX4 file in the "Indicators" folder if it's an indicator, the "Experts" folder if an EA, and the "Scripts" folder for EX4 files that are scripts.

In MetaTrader, you can see these files in the "Navigator" window. If you don't see that window, enable it via View > Navigator.

If you find that an application on your PC does try to open the file but it's the wrong application or you'd rather have another installed program open it, it's fairly simple to change file associations in Windows.

How to Convert an EX4 File

Since EX4 files are the compiled equivalent of MQ4 files, you'd need a decompiler to "convert" EX4 to MQ4. We're not aware of any decompilers that can do this.

You might be able to convert EX4 to EX5 or AFL (AmiBroker Formula Language). If so, it's most likely done through the MetaTrader program itself, but we haven't verified this.

Still Can't Open It?

If you can't open your file with MetaTrader, it's most likely not in a compatible format. This might happen if you've misread the file extension, which is surprisingly easy to do.

For example, even though the EX4 file extension shares some of the same letters as others like EXO, EXR, EXE, and E4A, none of those formats have anything to do with EX4 files. Trying to open those files in MetaTrader will most likely result in an error.

X4K is another example, but the file extension is reserved for XML4King Configuration files. Those files won't work in MetaTrader and neither will EX4 files open in XML4King.

Was this page helpful?