MetaTrader 5 HelpGetting StartedStart TerminalConfiguration File 

Configuration File

A client terminal can be started with a custom set of parameters. To do it, create a custom file of settings on the basis of the original common.ini file. To start the terminal with this file of settings, execute the following command in the command line:

path_to_terminal\terminal.exe /config:c:\myconfiguration.ini

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 client terminal. Thus, changes in settings made via the terminal interface are not written to the used configuration file.

Parameters of the configuration file are divided into several blocks and correspond to setting in the window of the client terminal settings. Below are the most important settings in a configuration file:

[Common]

Common terminal settings, analogous to the "Server" tab:

  • Login — number of account for connection. When connecting the client terminal tries to read the additional authorization details from the configuration file (server, password and certificate password specified in parameters described below). If the authorization details are not specified then the terminal tries to read it from its own database of accounts;
  • Server — address and port number of a trade server for connection separated with a colon;
  • Password — password to the account specified in the Login parameter;
  • CertPassword — password to the certificate. This parameter is required if the extended authorization mode is enabled for the account. If the certificate for the account is not installed in the storage of the operating system then its file must be located in the terminal_folder/config/certificates/ directory;
  • ProxyEnable — allow (1) or prohibit (0) connection via 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 — indication for saving the password between connections: 1 — to save, 0 — not to save.
  • NewsEnable — enable (1) or disable (0) receipt of news;
  • CertInstall —  install (1) or not (0) new certificates in the system storage (during extended authorization).

[Charts]

Settings of charts:

  • ProfileLast —  name of the current profile;
  • MaxBars — maximal number of bars in a chart;
  • PrintColor — chart printing mode: 1 — color printing, 0 — black-and-white printing;
  • SaveDeleted — save (1) or not (0) deleted charts for re-opening.

[Experts]

Settings of Expert Advisors:

  • AllowLiveTrading — allow (1) or prohibit (0) trading by Expert Advisors.
  • AllowDllImport — allow (1) or prohibit (0) DLL import;
  • Enabled — enable or disable use of Expert Advisors;
  • Account — allow (1) or not (0) Expert Advisors when an account is changed;
  • Profile — allow (1) or not (0) Expert Advisors when a profile is changed.

[Objects]

Settings of objects:

  • ShowPropertiesOnCreate — show (1) or not (0) object properties during creation;
  • SelectOneClick — select (1) or not (0) objects by a single click;
  • MagnetSens — object magnet sensibility;

[Email]

Settings of Email:

  • Enable — enable (1) or disable (0) use of email;
  • Server — address of the SMTP server;
  • Auth — encrypted information for authorizing on the mail server;
  • Login — login for authorizing on the SMTP server;
  • Password — password for authorizing on the SMTP server;
  • From — sender's name and address;
  • To — recipient's name and address.

[StartUp]

Configurations of Expert Advisors and scripts that will be automatically launched during the terminal start:

  • Expert — name of file of an Expert Advisor that should be launched when the client terminal is started. The Expert Advisor is launched on the chart that is opened in accordance with the "Symbol" and "Period" parameters. If the "Symbol" parameter is not specified, then an additional chart will not be opened, and the Expert Advisor will be launched on the first chart of the current profile. If the current profile does not contain a chart, the Expert Advisor will not be launched. If the "Expert" parameter is absent, then no Expert Advisors will be launched.
  • Symbol — name of a symbol which chart will be opened right after the terminal start. This chart will be used for applying an Expert Advisor or script to it. No information about this additional chart will be saved as the terminal is closed. During the next start of the client terminal without the configuration file, this chart will not be opened. If this parameter is absent, then no additional chart will be opened.
  • Periodperiod of a chart that is used for applying an Expert Advisor or script (any period from 21 available in the terminal). If this parameter is absent, the H1 period will be used.
  • Template — name of a template that will be applied to the chart.
  • ExpertParameters — name of a file containing parameters of an Expert Advisor. This file must be in the MQL5\presets directory of the terminal data folder. If this parameter is absent, the default parameters will be used.
  • Script — name of a script that should be launched during the terminal start. Scripts are launched according to the same rules as Expert Advisors.
  • ScriptParameters — name of a file containing parameters of a script. This file must be in the MQL5\presets directory of the terminal data folder. If this parameter is absent, the default parameters will be used.

[Tester]

Settings of the testing that is launched when the terminal is started:

  • Expert — name of file of an Expert Advisor that should be started for testing (optimization) when the terminal is started. If this parameter is absent the testing will not be launched.
  • ExpertParameters — name of a file containing input parameters of an Expert Advisor. This file must be in the \tester folder of the terminal installation directory.
  • Symbol — name of a symbol that will be used as a main symbol of testing. If this parameter is absent, the last selected symbols in the tester will be used.
  • Period — period of a chart for testing (any period from 21 available in the terminal). If this parameter is absent, the H1 period will be used.
  • Login — using this parameter, you can pass an account number that is allegedly used for testing to an Expert Advisor. The necessity of this parameter is built into an Expert Advisor in its source MQL5 code (using the AccountInfoInteger function).
  • Modelmode of tick generation (0 — "Every tick", 1 — "1 minute OHLC", 2 — "Open prices only", 3 — "Math calculations"). If this parameter is not specified, the mode of generation of every tick will be used.
  • ExecutionMode — the mode of trading emulated by the Strategy Tester (0 — common mode, 1 — random delay of execution of trade orders is enabled).
  • Optimization — enabling/disabling optimization and specification of its type (0 — optimization disabled, 1 — "Slow complete algorithm", 2 — "Fast genetic based algorithm", 3 — "All symbols selected in Market Watch").
  • OptimizationCriterionoptimization criterion for finding optimal parameters: (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 obtained from the OnTester() function in an Expert Advisor).
  • FromDate — date of the beginning of the testing range in the YYYY.MM.DD format. If this parameter is absent, the last specified date in the corresponding field of the strategy tester will be used.
  • ToDate — date of the end of the testing range in the YYYY.MM.DD format. If this parameter is absent, the last specified date in the corresponding field of the strategy tester will be used.
  • ForwardMode — mode of forward testing (0 — disabled, 1 — 1/2  of the test period, 2 — 1/3 of the test period, 3 — 1/4 of the test period, 4 — custom period, specified via the ForwardDate parameter).
  • ForwardDate — start date of forward testing in the YYYY.MM.DD format. The parameter is active only if ForwardMode=4.
  • Report — name of a file the testing or optimization report will be saved to. The file will be created in the client terminal directory. You can specify a path to save the file relatively to this directory, for example, \reports\tester.htm. If an extension is not specified in a file name, the ".htm" extension is automatically used for testing reports, and ".xml" is used for optimization reports. If this parameter is absent, the testing report will not be saved as a file. When enabling the mode of forward testing, its result will be saved in a separate file with the ".forward" suffix. For example, tester.forward.htm.
  • ReplaceReport — enabling/disabling the rewriting of the report file (0 — disabled, 1 — enabled). If the rewriting is disabled and a file with the same name already exists then the index number in square brackets will be added to the name of the file. For example, tester[1].htm. If this parameter is absent then "0" value will be used (rewriting disabled).
  • ShutdownTerminal — enabling/disabling shutting down of the client terminal at the end of testing (0 — disabled, 1 — enabled). If this parameter is absent, the "0" value is used (shutting down disabled). If the testing/optimization process is manually stopped by user, the value of this parameter is automatically reset to "0".
  • Deposit — amount of initial deposit for testing/optimization. The amount is specified in the deposit currency of the account. If this parameter is absent, the amount specified in the corresponding field of the strategy tester is used.
  • Leverage — leverage for testing/optimization. For example, 1:100. If this parameter is absent, the leverage specified in the corresponding field of the strategy tester is used.
  • UseLocal — enable/disable use of local agents for testing and optimization (0 — disable, 1 — enable). If this parameter is absent, current settings of the client terminal are used.
  • UseRemote — enable/disable use of remote agents for testing and optimization (0 — disable, 1 — enable). If this parameter is absent, current settings of the client terminal are used.
  • UseCloud — enable/disable use of agents of the MQL5 Cloud Network for testing and optimization (0 — disable, 1 — enable). If this parameter is absent, current settings of the client terminal are used.
  • Input parameters from a file specified in ExpertParameters are used for testing/optimization of an Expert Advisor.
  • If that setting is absent, parameters from an EA_name.set file located in the terminal_folder/tester/ directory are used for testing/optimization of an Expert Advisor. In such a file the last specified set of input parameters of an Expert Advisor is stored.
  • If there is no such file, then the default parameters specified in the code of the Expert Advisor will be used for testing. Optimization will be impossible.
  • In order to create or change a set of parameters, you should select an Expert Advisor at the "Settings" tab of the strategy tester and specify necessary input parameters and ranges of their variation at the corresponding tab.

Example of a Configuration File

[Common]

Login=1000575

ProxyEnable=0

ProxyType=0

ProxyAddress=192.168.0.1:3128

ProxyLogin=10

ProxyPassword=10

KeepPrivate=1

NewsEnable=1

CertInstall=1

 

[Charts]

ProfileLast=Euro

MaxBars=50000

PrintColor=0

SaveDeleted=1

 

[Experts]

AllowLiveTrading=0

AllowDllImport=0

Enabled=1

Account=0

Profile=0

 

[Objects]

ShowPropertiesOnCreate=0

SelectOneClick=0

MagnetSens=10

 

;+------------------------------------------------------------------------------

;|  Run an EA and/or script on the specified chart at terminal start            |

;+------------------------------------------------------------------------------

[StartUp]

;--- The EA is located in terminal_data_folder\MQL5\Experts\Examples\MACD\

Expert=Examples\MACD\MACD Sample

;--- The EA start parameters are located in terminal_data_folder\MQL5\Presets\

ExpertParameters=MACD Sample.set

;--- The script is located in terminal_data_folder\MQL5\Scripts\Examples\ObjectSphere\

Script=Examples\ObjectSphere\SphereSample

;--- Symbol chart that will be opened at the terminal start to run the EA and/or script

Symbol=EURUSD

;--- Chart timeframe that will be opened at the terminal start to run the EA and/or script

Period=M1

;--- Template that will be applied to the chart, located in terminal_installation_folder\Profiles\Templates

Template=macd.tpl

 

;+------------------------------------------------------------------------------

;| Start testing or optimization of the specified Expert Advisor                |

;+------------------------------------------------------------------------------

[Tester]

;--- The EA is located in terminal_data_directory\MQL5\Experts\Examples\MACD\

Expert=Examples\MACD\MACD Sample

;--- The EA parameters are located in terminal_installation_folder\tester\Presets\

ExpertParameters=macd sample.set

;--- The symbol for testing/optimization

Symbol=EURUSD

;--- The timeframe for testing/optimization

Period=M1

;--- Emulated account number

Login=123456

;--- Initial deposit

Deposit=10000

;--- Leverage for testing

Leverage=1:100;--- The "All Ticks" mode

Model=0

;--- Execution of trade orders with a random delay

ExecutionMode=1

;--- Genetic optimization

Optimization=2

;--- Optimization criterion - Maximum balance value

OptimizationCriterion=0

;--- Start and end dates of the testing range

FromDate=2011.01.01

ToDate=2011.04.01

;--- Custom mode of forward testing

ForwardMode=4

;--- Start date of forward testing

ForwardDate=2011.03.01

;--- A file with a report will be saved in terminal_installation_folder

Report=test_macd

;--- If the specified report already exists, it will be overwritten

ReplaceReport=1

;--- Set automatic terminal shutdown upon completion of testing/optimization

ShutdownTerminal=1

 

MetaTrader 5 — a complex trading platform for providing brokerage services on the retail Forex market.

Copyright 2000-2014, MetaQuotes Software Corp.