Metatrader folder structure

If you are an experienced trader or still a beginner, you have most likely already used the appropriate trading software, which is created by means of MetaTrader programming. Anyone who has worked with MetaTrader products at some point probably needed to install an expert, a script or an indicator into the program. And sometimes trading automation might seem a little difficult.

Usually MetaTrader trading programs are distributed as a single .ex4 or .ex5 file, which makes it easy to locate the necessary folder within the folder structure of the terminal according to the type of program (an expert, a script or an indicator). But sometimes an expert advisor programming product is distributed as a package of files without any guidelines concerning installation. In this case the user might get confused.

An example of files package for trading automation

This article will tell you about the MetaTrader folder structure and help you install the trading programs into the terminal.

Let’s take a look at the MetaTrader 4 and MetaTrader 5 folder structure.

MetaТrader 4 folder structure

This is how the MT4 folder structure looks like:

Metatrader4 folder structure

In the root directory of the terminal we are looking for templates and experts folders.

The templates file with a .tpl extension should be copied into the templates directory. After the copying these files will appear in the context menu of any chart in the terminal.

A Metatrader user template in the context menu of the chart

The experts directory appears to be more challenging. If we look closely at its content, we will find the text and .exe files of the Expert Advisors. The advisor files with the .mq4 and .ex4 extensions should be copied into this directory, any other files should be copied elsewhere.

In Metatrader 4 programming all advisors, indicators, scripts and libraries files, created by means of MetaTrader programming have similar extensions – .mq4 and .ex4. It is important not to confuse them and put them into appropriate directories:

Advisors into <terminal_directory>\experts

Indicators into <terminal_directory>\experts\indicators

Scripts into <terminal_directory>\experts\scripts

libraries into <terminal_directory>\experts\libraries

The .dll files, which serve as a specific function library and are created by means of other programming languages instead of mql4 programming, should be located into the \experts\libraries folder.

There are also header files with an .mqh extension. They need to be located into the <terminal_directory>\experts\include directory.

If you need to install the Advisor settings file, you have to place them into the \experts\presets directory.

Due to the features of MetaTrader 4 programming, the changes in the folders will not immediately be displayed in the terminal. You will have to restart the terminal to make the new programs available for use.

МetaТrader 5 folder structure

The MetaTrader 5 folder structure is slightly different from the previous version, but still it is quite easy to use.

MetaTrader 5 folder structure

Let’s look at the folders and their content.

MQL5\Experts – contains trading advisors.

MQL5\Indicators – contains user indicators.

MQL5\Scripts – contains script files.

MQL5\Include – contains .mqh header files.

MQL5\Libraries – contains .ex5 and .dll libraries.

Profiles\Templates – contains the chart settings templates.

The MetaTrader 5 developers added the feature of organizing your advisors, scripts or indicators in separate directories to make them more convenient to operate. To use this feature create a new folder inside any of the mentioned directories and place an advisor file there. Then you will see this folder in the navigator section of the program.

The user directory MyDirectory in the MetaTrader 5 navigator

Another convenient feature that was added to the MetaTrader 5 is that you don’t have to restart the terminal to make the new files available for use. You will just have to refresh the navigator window.

Refreshing the navigator window in MetaTrader5

Conclusion

As you can see, the MetaTrader programming makes the folder structure of the terminals in MetaTrader 4/5 quite easy and clear. You don’t have to be an expert to know how to operate this program. However, this article covers only the most frequently used terminal folders. If you need any help with other MetaTrader 4 or MetaTrader 5 files, feel free to request our assistance.