Select Language

Compile EA/indicator

MetaTrader 4 (MT4) / MetaTrader 5 (MT5) supports Expert Advisors (EAs) and indicators. To use an EA or indicator, you need to compile its source code before adding it to the platform.

Here we will look at how to compile EAs and indicators on MT4/MT5.

Switch between MT4/MT5 tabs to check the steps for each.

mt4
mt5

Step 1

Open the folder containing the EA/indicator source code that you downloaded from a website or created yourself, then double-click the .mq4 source file.

Double-click the source file Double-click the source file
point If the file extension is hidden

If the file extension is hidden, open Windows File Explorer, click the "View" tab, and check the "File name extensions" option to make it visible.

Make the extension visible Make the extension visible
point If MetaEditor can't be opened

Sometimes, MetaEditor may not open even after double-clicking the .mq4 file. In such cases, try reinstalling MetaTrader.

Related article: Uninstall MetaTrader
Download and install MT4/MT5 (Windows)
Download and install MT4/MT5 (macOS)

Step 2

In MetaEditor, click "Compile" at the top. If compilation fails, errors are shown in the Errors tab of the Toolbox. Review and fix them to try compiling again.

Click Compile Click Compile

Step 3

The ex4 file is created in the same folder as the mq4 file. Install this ex4 file to make the EA/indicator available.

Related article:  Install Expert Advisor (EA)
Install custom indicator
The ex4 file is created The ex4 file is created
point Auto-compilation in MT4

In MT4, you can automatically compile a source file by downloading an mq4 file instead of an ex4 file, then right-clicking "Expert Advisors" or "indicators" in the Navigator and clicking "Refresh". If the code has errors, compilation will fail.

Auto-compilation Auto-compilation

Step 1

Open the folder containing the EA/indicator source code that you downloaded from a website or created yourself, then double-click the .mq5 source file.

Double-click the source file Double-click the source file
point If the file extension is hidden

If the file extension is hidden, open Windows File Explorer, click the "View" tab, and check the "File name extensions" option to make it visible.

Make the extension visible Make the extension visible
point If MetaEditor can't be opened

Sometimes, MetaEditor may not open even after double-clicking the .mq5 file. In such cases, try reinstalling MetaTrader.

Related article: Uninstall MetaTrader
Download and install MT4/MT5 (Windows)
Download and install MT4/MT5 (macOS)

Step 2

In MetaEditor, click "Compile" at the top. If compilation fails, errors are shown in the Errors tab of the Toolbox. Review and fix them to try compiling again.

Click Compile Click Compile

Step 3

The ex5 file is created in the same folder as the mq5 file. Install this ex4 file to make the EA/indicator available.

Related article:  Install Expert Advisor (EA)
Install custom indicator
The ex5 file is created The ex5 file is created

Date

Created

 : 2025.10.15

Update

Last updated

 : 2025.10.21

Takayoshi Nakamaru

Manual production consultant, MBA

arrow
Takayoshi Nakamaru

Nakamaru is a manual production consultant at FINTECS, a company that specializes in creating manuals for their clients.
With a wide range of experience from fintech to entertainment, he presents what user-friendly manuals should be like.
He works with numerous large corporations as an external manual production project manager.

【Business information】
http://www.fintecs.co.jp/profile/

Supervisor

Akira Takagi

Systems engineer, MetaTrader administrator

arrow
Akira Takagi

After graduating from Computer Science at the Uninove, Brazil, in 2014, he has worked on various systems development projects.
He participated as a developer in the launch of forex services in 2019. Since then, he has also been involved in the development of MetaTrader plugins and APIs. He is certified by MetaQuotes as a MetaTrader5 Administrator and active in consulting and advisory as well.

Was this article helpful?

We hope you find this article useful. Any comments or suggestions will be greatly appreciated.  
We are also looking for writers with extensive experience in forex and crypto to join us.

please contact us at [email protected].

Thank you for your feedback.
Thank you for your feedback.

Disclaimer:arw

All information and content provided on this website is provided for informational purposes only and is not intended to solicit any investment. Although all efforts are made in order to ensure that the information is correct, no guarantee is provided for the accuracy of any content on this website. Any decision made shall be the responsibility of the investor and Myforex does not take any responsibility whatsoever regarding the use of any information provided herein.

The content provided on this website belongs to Myforex and, where stated, the relevant licensors. All rights are reserved by Myforex and the relevant licensors, and no content of this website, whether in full or in part, shall be copied or displayed elsewhere without the explicit written permission of the relevant copyright holder. If you wish to use any part of the content provided on this website, please ensure that you contact Myforex.

  • Facebook
  • Twitter
  • LINE

Myforex uses cookies to improve the convenience and functionality of this website. This website may include cookies not only by us but also by third parties (advertisers, log analysts, etc.) for the purpose of tracking the activities of users. Cookie policy

I agree
share
Share
Cancel