Program Folder of MetaTrader 4 Client Terminal

Nikolay Kositsin | 25 February, 2009


Introduction

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:

Conclusion

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++" http://notepad-plus.sourceforge.net/