Optimization represents consecutive passes of the same expert with different inputs on the same data. At that, such parameters can be taken that make the expert efficiency maximal. The terminal possesses in-built means that allow to automate this process. Before beginning to optimize expert parameters, one has to set them up. It means that one has to:
A special window named "Tester" is used for testing and optimization of experts in the terminal. All settings listed above can be made in the "Settings" tab of this window.
One has to select expert the parameters of which should be optimized in the "Tester Experts" window. Not any expert file can be selected in this field, but only those that are available in the client terminal. For this, they must be compiled and placed in the /EXPERTS folder.
After the expert has been selected, one has to make an additional setup and set the inputs. This can be done by pressing of the "Expert properties" button.
At that, a new window containing the following three tabs will appear:
General optimization parameters are set in this tab. They include the initial deposit volume and currency to be specified in the corresponding fields. It is this deposit that will be operated by the expert during optimization.
Types of positions to be opened are selected in this tab, as well: Only Long, Only Short, or Long and Short. Whatever expert algorithm is used, it will open positions only in the directions defined here.
One can turn on the genetic algorithm of optimization here. Detailed information about it is available in "Genetic algorithms: Mathematics" article.
An optimized parameter is a certain factor, whose value defines the quality of a tested set of parameters. The higher the value of the optimization criterion is, the better the testing result with the given set of parameters is considered to be. The following parameter are available for optimization:
All inputs are listed here as a table. Inputs are variables that influence the expert operation and can be changed directly from the client terminal. For these parameters to be changed, there is no need to change the expert code. The amount of inputs can vary depending of experts.
At optimization, the expert inputs are set in the fields of "Start", "Step", and "Stop". Initial values, change interval, and final values of external variables will be set in these fields, respectively. There are checkboxes to the left of variable names that include the parameter into optimization process. If a variable is not checked in this checkbox, it will not be involved into optimization. Its value will not be changed within the optimization process, and the parameter given in the "Value" field will be written here. The amount of expert passes depends on these parameters directly. Data written in the "Value" field do not influence the expert optimization and are necessary only for its testing.
The set of inputs already saved before (including those given in the fields of "Start", "Step", and "Stop") can be downloaded. This can be done by pressing of the "Load" button and having selected the preliminarily saved set of parameters. The current set of external variables can be saved by pressing of the corresponding button.
Optimization this tab allows to manage limitations during optimization. If any of conditions is met during a separate pass, this pass of the expert will be interrupted. Optimization will continue with the next pass.
To enable a limit in condition, one has to flag it in the checkbox to the left of it. Double click with the left mouse button in the "Value" field can be used to change the existing parameter; after typing new value, press "Enter". Limiting parameters are:
It is not enough just to select an expert and set it up to start optimization: a symbol and its period (timeframe) must be selected for tests. These are the data on which all tests will be made. A symbol available in the terminal or an external data file can be used for tests. History data files in *.FXT format to be stored in the /TESTER directory are used in tests. These files are created at tests automatically if the corresponding symbol available in the terminal was selected.
Symbol is defined in the "Symbol" field, and timeframe is in the "Period". If there is no data file for this symbol, period, and modeling method, it will be created automatically. If there are no history data for the symbol and period, the tester will download 512 latest history bars automatically.
Attention: If there are any data outside the latest 512 bars for a symbol, the data will be downloaded automatically up to the last available bar. This can cause sharp increase of incoming traffic.
History data are saved in the terminal only as bars and represent records appearing as TOHLCV (HST format). These data can be used for modeling of price changes at testing experts. In some cases, such information is not enough for testing. For example, for the daily timeframe, price changes within a bar can result in triggering of the expert. At the same time, no triggering can occur at testing. In other words, testing an expert based on only bars can be inaccurate and give a false idea about the expert efficiency.
Terminal allows to test experts by various methods of history data modeling. Using history data from smaller periods, it is possible to see price fluctuations within bars, i.e., price changes will be emulated more precisely. For example, when an expert is tested on one-hour data, price changes for a bar can be modeled on one-minute data. Thus, modeling brings history data near the real price fluctuations and makes expert testing more authentic.
One of three history data modeling methods can be chosen for testing:
The price history stored in the client terminal includes only Bid prices. On default, to model Ask prices, the strategy tester uses the current spread of a symbol at the beginning of testing. However a user can set a custom spread for optimization in the "Spread" field.
The range of dates allows to test experts not on all available data, but within a certain time space only. This can be useful if there is a need to test a certain part of history data. Date range can be used not only for expert testing, but also for modeling of the testing succession of bars (file of data modeled to be used for testing). It is often no need to model data of the entire history, especially for every-tick modeling where the amount of unused data can be very large. That is why, if data range was allowed to be set at the initial modeling of testing succession, bars that are beyond this range will not be modeled, but just transcribed into the output succession. The data will not be excluded from the succession in order the correct calculation of indicators on the entire received history to be possible. It must be noted that the first 100 bars will not be modeled either. This limitation does not depend on the date range defined.
To enable date range limitation, one has to flag "Use date" and specify the necessary values in the fields of "From" and "To". After all settings have been made, one can press the "Start" button and start testing. After testing has started, the approximate time of completing of this process can be viewed in the lower part of the window.