Before developing trading applications, users need to understand the data storage principles in the trading platform and MetaEditor.
All files for algorithmic trading (ready-made programs) and application development in MetaEditor environment are located in the /MQL5 (/MQL4) directory of the trading platform. To quickly jump to it, click Open Data Folder in the File menu. The directory location relative to the platform installation folder depends on the MetaEditor launch mode.
Files in the /MQL5 (/MQL4) directory are located depending on their purpose and application type:
Folders and files |
Description |
---|---|
/Experts |
Folder for storing compiled (*.ex5, *.ex4) and source files of EAs (*.mq5, *.mqh, *.mq4). |
/Files |
Folder for storing various files used by EAs and scripts. |
/Images |
Folder for storing *.bmp images used in programs. |
/Include |
Folder for storing common *.mqh files included in various programs. |
/Indicators |
Folder for storing compiled and source files of custom indicators. |
/Libraries |
Folder for storing MQL5/MQL4 libraries. |
/Logs |
Contains Expert Advisor log files (yyyymmdd.log). These files are created separately for each day of the EA operation, their names correspond to their creation date: yyyy stands for the year, mm – month, dd – date. |
/Presets |
This folder stores the sets of parameters for launching EAs (Input parameters). |
/Scripts |
Folder for storing compiled and source files of scripts. |
/Shared Projects |
Folder for working with shared projects. |
experts.dat |
Contains the EA database. |
mql5.storage |
MQL5 Storage service data. |
The files should be arranged carefully when developing MQL4/MQL5 applications. The correct arrangement of files greatly simplifies working with large projects.
If you develop a trading robot, create a separate folder for it in the Experts directory. For indicators – in the Indicators directory, for scripts – in Scripts, etc. Place all files used for an application development in its folder except for common files (standard library, shared include files).
The Navigator window is used for managing the application structure.
Creating folders and placing files To create folders, use an OS explorer or the Navigator window. To create a sub-directory via the Navigator, select the necessary folder and click "New folder" in the context menu. Next, set the folder name and press Enter. To move a file to the created folder, simply drag it there (Drag'n'Drop). File arrangement During a compilation, executable program files (*.EX4 or *.EX5) are created in the same folder as the main source code file of a program (*.MQ4 or *.MQ5) or a project file (MQPROJ). The main file is an MQ4 or MQ5 file containing so-called entry points – predefined functions initializing the application operation (for example: OnInit, OnStart, OnChartEvent, etc.). The main file may include other MQ4, MQ5 and MQH files, although it is the main file that should be compiled to create an executable program file. Consider the location of files when including them (*.MQH) to your program's code. If an include file is located in the same folder as the main one, use the following statement:
If the file is located in the standard Include directory:
You can also specify a relative path to the file:
|
|