What Is an MQ4 File?

The MetaQuotes Language 4 format uses MQ4 for its source code

What to Know

  • An MQ4 file is an MQL4 source code file.
  • Open one with MetaTrader 4 or a text editor.
  • It's automatically converted to EX4 when put in the Indicators folder.

This article explains what an MQ4 file is and how to open one. It also describes how to convert an MQ4 file to a different format, like EX4 or C#.

What Is an MQ4 File?

A file with the MQ4 file extension is an MQL4 source code file. It contains variables and functions, as well as comments, related to the MetaQuotes Language 4 programming language.

You can read a lot more on this format, and MQ4 files, at MQL4.com.

MQ4 files in Windows that open with MetaTrader 4

Although they look similar, MQ4 files aren't at all related to MP4 files.

How to Open an MQ4 File

Open MQ4 files with MetaQuotes MetaTrader platform. However, because they're associated with version 4 of the program, you probably can't use one in newer versions like MetaTrader 5.

Instead, install the older version: you can download MT4 from FXCM.

In addition to the MT4 application, open an MQ4 file with Notepad or any other text editor to see the source code information. However, please know that this isn't the best method for viewing one, since the MetaTrader program is built specifically for using this file and displaying its information properly.

MQ4 file open as a text document
MQ4 File Open in Notepad++.

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 the file, see our How to Change File Associations in Windows guide for help making that change.

How to Convert an MQ4 File

MetaTrader 4 converts MQ4 files to EX4 automatically when you import the file into the Indicators folder. If you have MetaTrader open when the file is copied to that folder, close and reopen the program to generate the EX4 file.

You can convert MQ4 to C# with the online MQ4 to cAlgo Converter. Open the file with a text editor to copy its contents, paste it into that website, and then use the convert button to produce the C# result.

This blog on forex trading shows how to convert MQL 4 code to MQL 5 code.

Still Can't Open It?

If the file doesn't open with MetaTrader, then it's likely that you're misreading the file extension. This is fairly easy to do since there are other file extensions that are spelled almost exactly like MQ4 but aren't at all associated with foreign exchange trading programs.

MQO is a good example. This file extension is used by the 3D modeling software Metasequoia as a document file format.

Other files that are easy to confuse for an MQL4 source code file are Sony movie format files and NP4 scheduling files. The first is a video, so you need a video player like QuickTime to play one; and the second is made with the scheduling software NetPoint.

Double-check the file extension at the end of your file to make sure you're reading it correctly, and then do some research on the web to learn more about the format it could be in and the programs that are able to open and convert it.

Was this page helpful?