Program Folder of MetaTrader 4 Client Terminal

25 February 2009, 10:54
Nikolay Kositsin
7 049


In this article I would like to pay special attention to the program files folder of MetaTrader 4 client terminal. This is connected with the fact that already during the first meeting of the terminal and during all the other time of the serious work with it we often face the necessity to refer to the contents of this folder. So it would be very useful to study the purpose of all its contents.

Program Files of MetaTrader 4 Terminal

If you do not change any settings during the installation of mt4setup.exe distribution file, all program files of the terminal will be installed in the following directory: "C:\Program Files\MetaTrader".

Most users have the practical interest first of all in subfolders and a couple of executable files: the MetaTrader 4 terminal "terminal.exe" and MQL4 code editor "MetaEditor.exe". Help files "chm" can be accessed from the terminal and MetaEditor windows, so there is no point in looking for them in the program folder.

From one program file only one client terminal window, as well as only one MetaEditor window can be called. Usually in practice working with one window is not enough. In such a case one can simply make as many copies of the folder with program files "MetaTrader" as is necessary assigning to copies different names, placing them in necessary directories and creating desktop shortcuts of "terminal.exe" and "MetaEditor.exe" from each folder. In this case all terminals started from different folders will operate absolutely independently. Here a small detail should be added: when several client terminals are running at the same time, their shortcuts in the Windows taskbar are identical, which makes some inconveniences and confusions when working with them:

This problem can be easily solved: you should simply place various icon files named "terminal.ico" in all copied terminal folders near the files "terminal.exe":

After that each MetaTrader 4 terminal will have its own icon in the Windows taskbar:

But here you should take into account the fact that at the next installation of a new terminal version this icon will be deleted. For its easier restoration place the same icon in the same folder as a self-unpacking RAR archive together with the terminal.ico icon. In such a case after installation you can start the file and the necessary icon will appear in its place again.

Subfolders of the Client Terminal

There are 14 folders inside the folder "C:\Program Files\MetaTrader":

Let's view their contents.

1. "config"

This folder contains all configuration settings of the client terminal that are set in the options of MetaTrader 4 terminal (MetaTrader 4/Menu/Settings).

You can simply copy this folder into program files of another terminal so that the new terminal had absolutely analogous settings. Only the account password will be lost. The contents of this folder are actually two groups of files with extensions "srv" and "ini". Files with the "srv" extension store IP addresses of brokers' servers that are reflected in the settings window in the tab "Server" - checkbox "Server":

The mutually definite correlation exists between names of "ini" files of this folder and tabs of the settings window. Besides these terminal settings files, the configuration and setup file "metaeditor.ini" appears in this folder after MetaEditor start. This file stores all parameters and first of all color settings of MQL4 code editor:

2. "deleted"
I suppose there are no questions with the contents of this folder: chat windows closed in the terminal are stored here in the form of "tpl" files.

3. "experts"
This is probably the most topical and often opened folder of MetaTrader 4 terminal. But the contents of this folder are well described (MQL4 Book\File System), and no need to go into details. A few words can be added about the folder "C:\Program Files\MetaTrader\experts\logs", which stores operation log files of indicators and Expert Advisors, i.e. all the information reflected in the terminal window in the Experts tab of the client terminal:

As time goes by, logs stored in this folder become irrelevant, while the size of this folder keeps on growing! Besides, if several terminals are used at the same time, the size increases many times. So, unnecessary files should be deleted from this folder from time to time.

4. "history"
This folder contains history data downloaded by the terminal from brokers' servers. The data are used to construct charts in the client terminal.

The information is stored in subfolders (a folder for each broker) in the form of files with the "hst" extension. In my Windows operating system I changed the reflection of these files into forms for convenient for my perception:

File names speak for themselves and do not need to be commented. The most suitable explorer and editor for these files is the "History Center" window (F2):

that is called from "MetaTrader 4 Menu/Tools/History Center". Using the "Export" and "Import" buttons we can convert history data from side programs into MetaTrader 4 format and vice versa. Here you should note that server time may differ at different brokers (shift by Greenwich), that is why collecting history data from different brokers into one hst file can give incorrect results. Besides history folders, this folder also contains the terminal news file - news.dat.

5. "languages"
All language files of the program are stored here. In most cases one may need only files of one's native language and the international English files.

6. "links"
A folder of links to a broker's website.

7. "liveupdate"
In this folder temporary program files are stored when the automatic update of the terminal is performed. In most cases you do not need to do anything in this folder.

8. "logs"

This folder stores log files of the terminal operation (terminal start, upload of indicators and EAs, connection and loss of connection with a trade server, trade operations, etc.), i.e. information displayed in the "Journal" tab of the terminal window:

This folder also needs the deletion of unnecessary old log files from time to time.

9. "mailbox"
In this place all information received via the internal terminal mail is stored in this place:

In most cases there is no need to store this information for a long time period. So this folder also should be cleared sometimes.

10. "profiles"

In the "profiles" folder profiles are stored not as files, but as folders in which charts are represented as files of the "chart01.CHR, chart02.CHR, chart03.CHR, etc." type. So for moving templates between terminals all you need is to move template folders from the "profiles" folder of one of terminals into the analogous folder of another one. Besides templates the "lastprofile.ini" file can be interesting to you - this file stores the last template uploaded to the terminal.

11. "SOUNDS"
This folder stores audio files that are used for alerting about system events that take place in the terminal:

If you do not like sounds played by the terminal, you can add your own audio files and setup the terminal to use them.

12. "symbolsets"
In this folder settings of the "Market watch" window are saved:

13. "templates"
This is the folder of chart templates (files with the "tpl" extension) that can be used many times for the quick construction of formed charts. If you do not like chart templates used by default when new charts are created:

you can easily create your own template that should be saved as "default.tpl". After that all newly opened chart will be drawn in the form saved in this template. Besides this folder contains files with the "htm" extension that are templates of htm-reports of the client terminal, tester and strategy optimizer. These templates are written in English. They can be manually translated into any other language using any HTML editor.

14. "tester"
In this folder you will find everything connected with EA testing and optimization results:

Inside the folder there are four subfolders and files with the "ini" and "set" extensions. Files of these two types store values of an EA's input parameters. When you open the "Expert properties" window, then the "Inputs" tab in the strategy tester, after a click on "Ok" current input parameters of an Expert Advisor will be automatically saved into a file with the "ini" extension. At further EA downloads and in the current state the Expert Advisor's input parameters will possess values from the "ini" file. Files with the "set" extension are used for loading and saving EA's parameters via a dialog using the "Load" and "Save" buttons of the "Expert properties" window.

In the "caches" subfolder optimization results are stored in the cashed form. This cache should be cleared from time to time. The "history" folder contains history files of the "fxt" format generated from files of the "hst" format. These files can be of a very large size, so it can hardly be reasonable to store them permanently. The more so, these files are generated again at each testing or optimization. And one more subfolder of the "tester" folder is "logs" - it contains records of the strategy tester journal in the form of log-files:


Of course, in this article I dwelt on the most urgent files and folders only. You could find pretty more things inside the program folder. But the above discussed ones are enough for understanding the operation of the client terminal and starting to work with its program folder, while the excess of additional data may cause confusion.

And the last thing I would like to add is the fact that when working with MetaTrader 4 files you often need to use a text editor. The Windows text editor seems to be not enough for me. So it would be better to use a test editor of a side developer. For me, the best idea is to use the free and maximally functional editor "Notepad++"

Translated from Russian by MetaQuotes Software Corp.
Original article:

Attached files | (29.75 KB)
Last comments | Go to discussion (2)
wsjalerts13 | 2 Apr 2009 at 17:18
The only thing that I don't like about MetaTrader is you cannot undock a chart outside of the terminal window, have to use another instance of terminal that's lame.
MQL4 Comments
MQL4 Comments | 30 Jan 2012 at 10:45

Hi Nikolay,

thank you for your informative article. I am referring to: 14. "tester"

I would like to ask you, and of course anyone else who has an answer to this, how to call back the optimization results including all passes (which can be a couple of thousands sometimes) into mt4, after closing the terminal?

I mean how to access them via mt4 terminal. Currently I am copying and saving the optimization results in excel. But everytime I want to backtest a certain set of parameters, I have to type them manually into the expert properties window.

Is it possible to store all optimisation results automatically as .set files with an identifienable ending like p1,p2... for pass1, pass2 etc.? Although I can locate the cache file of the optimization, I can't do anything with it since I don't now how to open it. There is no format for it.

Thank you very much!


Visual Testing of the Profitability of Indicators and Alerts Visual Testing of the Profitability of Indicators and Alerts

What indicator of trading alerts or just the methods of their calculating to use is usually decided when testing EAs using these alerts. However, it is not always possible/necessary/reasonable to write an EA for each indicator. You can promptly calculate the profitability of trading on the alerts from other indicators, using a special indicator that collects their alerts itself and draws a picture of ideal trading with them. It can help you both make a visual estimate of the results obtained and quickly choose most optimal parameters.

To Sleep, or Not to Sleep? To Sleep, or Not to Sleep?

An alternative use of the Sleep() function in the realization of pauses between EA's actions is proposed. The approach under consideration allows a smart use of machine time.

Fallacies, Part 2. Statistics Is a Pseudo-Science, or a Chronicle of Nosediving Bread And Butter Fallacies, Part 2. Statistics Is a Pseudo-Science, or a Chronicle of Nosediving Bread And Butter

Numerous attempts to apply statistical methods to the objective reality, i.e. to financial series, crash when met with the nonstationarity of processes, "fat tails" of accompanying probability distributions, and insufficient volume of financial data.In this publication I will try to refer not to the financial series as such, but to their subjective presentation - in this case, to the way a trader tries to halter the series, i.e. to the trading system. The eduction of statistical regularities of the trading results process is a rather enthralling task. In some cases quite true conclusions about the model of this process can be made, and these can be applied to the trading system.

Recipes for Neuronets Recipes for Neuronets

The article is intended for beginners in baking "multi-layered" cakes.