After installation, a group of programs of the trading platform is added to the Start menu, and the program shortcut is created on the desktop. Use them to run the platform.
Two copies of the platform cannot run from the same directory. If you need to run multiple copies at the same time, install the appropriate number of programs in different directories.
There are two main modes of trading platform start, as well as some additional methods.
Starting from MS Windows Vista, applications installed to Program Files are not allowed to store their data in the installation folder on default. All data should be stored in a separate Windows user directory.
Thus, if the platform is installed in the Program Files directory and user rights to write to that directory are limited, it is run in the main mode. The main mode is also used in the following situations:
- If the UAC (User Activity Control) system is enabled.
- If remote connection to a computer is used (RDP, Remote Desktop Protocol).
In this mode, the editable files of the platform are stored in a specific Windows user directory, and the immutable files are stored in Program Files. Immutable files include executables of the platform, of MetaEditor, standard sounds, etc. Editable files are:
- all platform settings, configuration files;
- all the databases (price history);
- platform and expert journals;
- all profiles.
All the editable files of the platform are stored in the following directories (depending on the operating system used):
Microsoft Windows XP SP3:
- C:\Documents and Settings\username\Application Data\MetaQuotes\Terminal\instance_id\
Microsoft Windows Vista and higher:
Here 'C' is the logical drive letter on which Windows is installed, "username" is the account name in the operating system under which the platform has been installed, "instance_id" is a unique identifier generated based on the path to the directory where the platform is installed.
For quick access to these folders, use the command " Open Data Folder" in the File menu. Each data folder contains a special text file origin.txt. This file contains the path to the platform installation folder, which corresponds to this data directory.
When installed to Program Files, the platform works in the main mode described above on default. All the platform data are stored in a special Windows user directory. However you can force the platform to store its data in the installation folder. To do it, run the platform in the portable mode. To use this mode, start the platform from the command line with the additional /portable key. For example, "C:\Program Files\MyTerminal\terminal.exe /portable".
To run the platform in the Portable mode, the following conditions must be met:
Running from the Command Line
The trading platform can be run manually with predefined parameters. This can be done by using different keys for starting from a command line and alternative configuration files.
The platform can be run with the keys from the command line. Specify there a path to the executable platform file (path to the file\terminal.exe) and after a space add one or several of the below keys:
- /login:login number — running a platform under a certain account. For example, terminal.exe / login:100000.
- /config:path to a configuration file — running a platform with an alternative configuration file. For example, terminal.exe /config:c:\myconfiguration.ini. The default configuration file is common.ini.
- /profile:profile name — running the platform with a definite profile. The profile must be pre-created and located in the /profiles/charts/ of the platform. For example, terminal.exe /profile:Euro.
- /portable — set the platform to run in the Portable mode. Running in this mode may be needed if the platform was earlier launched in the main mode. To run the platform in the portable mode, the operating system user requires appropriate permissions.
If the key assignment is set incorrectly (invalid login, profile name or configuration file), the default value will be used.
Running with a Custom Configuration File
The trading platform can be run with a custom set of parameters. Create your own configuration file based on the default common.ini. To start the platform with a custom configuration file, run the following command in the command line:
where "c:\myconfiguration.ini" is the path to the custom configuration file.
Custom configuration files are used in the "read only" mode during the work of the platform. Changes in settings made from the platform interface are not written to the used custom configuration file.
The configuration file parameters are divided into several blocks and correspond to the settings on platform configuration window tabs. Below are the most important settings in the configuration file:
Common platform settings similar to the Server tab:
- Login — account number. The platform tries to read additional authorization information from a configuration file (server, password and certificate password specified in the parameters described below). If the authorization information for the account is not specified, the platform tries to read it from its own account database;
- Server — address and port number of a trade server separated with a colon;
- Password — password for connecting to the account specified in the Login parameter;
- CertPassword — certificate password. This parameter is required if the extended authentication mode is enabled for the account. If the used certificate is not installed in the operating system storage, its file should be placed in platform_folder/config/certificates/;
- ProxyEnable — allow (1) or prohibit (0) connection through a proxy server;
- ProxyType — type of a proxy server: 0 (SOCKS4), 1 (SOCKS5), 2 (HTTP);
- ProxyAddress — IP address and port of the proxy server separated by a colon;
- ProxyLogin — login for authorizing on a proxy server;
- ProxyPassword — password for authorizing on a proxy server;
- KeepPrivate — saving the password between connections: 1 — to save, 0 — not to save.
- NewsEnable — enable (1) or disable (0) news letters;
- CertInstall — install (1) or do not install (0) new certificates in the system storage (for extended authentication).
- MQL5Login — account on MQL5.community.
- MQL5Password — password for the specified account on MQL5.community.
- ProfileLast — the name of the current profile;
- MaxBars — the maximum number of bars in a chart;
- PrintColor — chart print mode: 1 — color printing, 0 — black-and-white printing;
- SaveDeleted — save (1) or not (0) deleted chart to reopen later.
Expert Advisor settings:
- AllowLiveTrading — enable (1) or disable (0) automated trading using Expert Advisors.
- AllowDllImport — DLL import allowed (1) or not (0);
- Enabled — enable or disable use of Expert Advisors;
- Account — disable (1) or not (0) Expert Advisors when connecting with a different account;
- Profile — disable (1) or not (0) Expert Advisors after change after change of the active profile.
- ShowPropertiesOnCreate — show (1) or do not show (0) properties of objects being created;
- SelectOneClick — select (1) or not (0) objects at a single mouse click;
- MagnetSens — docking sensitivity of objects;
- Enable — enable (1) or disable (0) use of email;
- Server — address of the SMTP server;
- Auth — encrypted information for authentication on the mail server;
- Login — login for the SMTP server;
- Password — password for the SMTP server;
- From — sender's name and address;
- To — recipient's name and address.
Settings of Expert Advisors and scripts, that open automatically when you start the platform:
- Expert — file name of the Expert Advisor that opens automatically when you start the platform. The Expert Advisor runs on the chart that opens in accordance with the Symbol and Period parameters. If the Symbol parameter is not set, no additional chart will be opened in the platform. The Expert Advisor will run on the first chart of the current profile in this case. If the current profile has no charts, the Expert Advisor will not be started. If the Expert parameter is not set, no Expert Advisors will be started.
- Symbol — the symbol of the chart that opens straight after the platform start. An Expert Advisor or a script will be added to this chart. No information about this additional chart will be saved as the platform is closed. During the next start of the platform without the configuration file, this chart will not be opened. If this parameter is not set, no additional chart will be opened.
- Period — the timeframe of the chart, to which an Expert Advisor or a script will be added (any of the 21 periods available in the platform). If the parameter is not set, default H1 is used.
- Template — the name of the template to be applied to the chart.
- ExpertParameters — the name of the file that contains Expert Advisor parameters. The file must be located in the folder MQL5\presets of the platform data directory. If this parameter is not set, default settings will be used.
- Script — the name of the script that opens automatically when you start the platform. Scripts are run by the same rules as Expert Advisor.
- ScriptParameters — the name of the file that contains script parameters. The file must be located in the folder MQL5\presets of the platform data directory. If this parameter is not set, default settings will be used.
Parameters of testing that starts automatically when you run the platform:
- Expert — the file name of the Expert Advisor that will automatically run in the testing (optimization) mode. If this parameter is not present, testing will not run.
- ExpertParameters — the name of the file that contains Expert Advisor parameters. This file must be located in the MQL5\Profiles\Tester folder of the platform installation directory.
- Symbol — the name of the symbol that will be used as the main testing symbol. If this parameter is not added, the last selected symbol in the tester is used.
- Period — testing chart period (any of the 21 periods available in the platform). If the parameter is not set, default H1 is used.
- Login — this parameter communicates to the Expert Advisor the value of an account, on which testing is allegedly performed. The need for this parameter is set in the source MQL5 code of the Expert Advisor (in the AccountInfoInteger function).
- Model — tick generation mode (0 — "Every tick", 1 — "1 minute OHLC", 2 — "Open price only", 3 — "Math calculations", 4 — "Every tick based on real ticks"). If this parameter is not specified, Every Tick mode is used.
- ExecutionMode — trading mode emulated by the strategy tester (0 — normal, -1 — with a random delay in the execution of trading orders, >0 — trade execution delay in milliseconds, it cannot exceed 600 000).
- Optimization — enable/disable optimization, its type (0 — optimization disabled, 1 — "Slow complete algorithm", 2 — "Fast genetic based algorithm", 3 — "All symbols selected in Market Watch").
- OptimizationCriterion — optimization criterion: (0 — the maximum balance value, 1 — the maximum value of product of the balance and profitability, 2 — the product of the balance and expected payoff, 3 — the maximum value of the expression (100% - Drawdown)*Balance, 4 — the product of the balance and the recovery factor, 5 — the product of the balance and the Sharpe Ratio, 6 — a custom optimization criterion received from the OnTester() function in the Expert Advisor).
- FromDate — starting date of the testing range in format YYYY.MM.DD. If this parameter is not set, the date from the corresponding field of the strategy tester will be used.
- ToDate — end date of the testing range in format YYYY.MM.DD. If this parameter is not set, the date from the corresponding field of the strategy tester will be used.
- ForwardMode — forward testing mode (0 — off, 1 — 1/2 of the testing period, 2 — 1/3 of the testing period, 3 — 1/4 of the testing period, 4 — custom interval specified using the ForwardDate parameter).
- ForwardDate — starting date of forward testing in the format YYYY.MM.DD. The parameter is valid only if ForwardMode=4.
- Report — the name of the file to save the report on testing or optimization results. The file is created in the trading platform directory. You can specify a path to save the file, relative to this directory, for example, \reports\tester.htm. The subdirectory where the report is saved should exist. If no extension is specified in the file name, the ".htm" extension is automatically used for testing reports, and ".xml" is used for optimization reports. If this parameter is not set, the testing report will not be saved as a file. If forward testing is enabled, its results will be saved in a separate file with the ".forward" suffix. For example, tester.forward.htm.
- ReplaceReport — enable/disable overwriting of the report file (0 — disable, 1 — enable). If overwriting is forbidden and a file with the same name already exists, a number in square brackets will be added to the file name. For example, tester.htm. If this parameter is not set, default 0 is used (overwriting is not allowed).
- ShutdownTerminal — enable/disable platform shutdown after completion of testing (0 — disable, 1 — enable). If this parameter is not set, the "0" value is used (shutdown disabled). If the testing/optimization process is manually stopped by a user, the value of this parameter is automatically reset to 0.
- Deposit — initial deposit for testing optimization. The amount is specified in the account deposit currency. If the parameter is not specified, a value from the appropriate field of the strategy tester is used.
- Currency — deposit currency for testing/optimization purposes. Specified as a three-letter name, e.g. EUR, USD, CHF etc. Please note that cross rates for converting profit and margin to the specified deposit currency must be available on the account, to ensure proper testing. If the parameter is not specified, a value from the appropriate field of the strategy tester is used.
- Leverage — leverage for testing/optimization. For example, 1:100. If the parameter is not specified, a leverage from the appropriate field of the strategy tester is used.
- UseLocal — enable/disable the use of local agents for testing and optimization (0 — disable, 1 — enable). If the parameter is not specified, current platform settings are used.
- UseRemote — enable/disable use of remote agents for testing and optimization (0 — disable, 1 — enable). If the parameter is not specified, current platform settings are used.
- UseCloud — enable/disable use of agents from the MQL5 Cloud Network (0 — disable, 1 — enable). If the parameter is not specified, current platform settings are used.
- Visual — enable (1) or disable (0) the visual test mode. If the parameter is not specified, the current setting is used.
- Port — the port, on which the local testing agent is running. The port should be specified for the parallel start of testing on different agents. For example, you can run parallel tests of the same Expert Advisor with different parameters. During a single test port can be omitted.
Example of a Configuration File
;| Running an EA and/or script on the specified chart at the platform start |
;--- The Expert Advisor is located in platform_data_directory\MQL5\Experts\Examples\MACD\
;--- EA start parameters are available in platform_data_directory\MQL5\Presets\
;--- The script is located in platform_data_directory\MQL5\Scripts\Examples\ObjectSphere\
;--- Symbol chart, which will be opened when you start the platform, and EA and/or script will run on it
;--- Chart timeframe, which will be opened when you start the platform, and EA and/or script will run on it
;--- The template to apply to a chart is located in platform_installation_directory\Profiles\Templates
;| Start Expert Advisor testing or optimization |
;--- The Expert Advisor is located in platform_data_directory\MQL5\Experts\Examples\MACD\
;--- The Expert Advisor parameters are available in platform_installatoin_directory\MQL5\Profiles\Tester\
;--- The symbol for testing/optimization
;--- The timeframe for testing/optimization
;--- Emulated account number
;--- Initial deposit
;--- Leverage for testing
;--- The "All Ticks" mode
;--- Execution of trade orders with a random delay
;--- Genetic optimization
;--- Optimization criterion - Maximum balance value
;--- Dates of beginning and end of the testing range
;--- Custom mode of forward testing
;--- Start date of forward testing
;--- A file with a report will be saved to the folder platform_installation_directory
;--- If the specified report already exists, it will be overwritten
;--- Set automatic platform shutdown upon completion of testing/optimization