Optimization Types
Two optimization types are available in the tester. You can select the appropriate one on the "Settings" tab of the Strategy Tester.
Slow Complete Algorithm
In this mode, runs are performed for all possible combinations of values of input variables selected for optimization on the appropriate tab.
This method is the most precise one. However, running the Expert Advisor with all possible combinations takes much time.
Fast Genetic Based Algorithm
This type of optimization is based on the genetic algorithm of searching the best values of input parameters. This type is much faster than the first one and is almost of the same quality. Optimization with the trying all combinations that would take several years is conducted within several hours with this genetic algorithm.
Each individual has a certain set of genes which corresponds to the set of their parameters. Genetic optimization is based on the constant selection of the most "adapted" parameters (values that give the best result). In the general form, the algorithm can be represented the following way:
- From the total number of all possible combinations of parameters, two populations (sets) are selected by a random sample;
- Both sets are tested and the one with the best results (according to the optimization criterion) is left;
- The set members are randomly crossed with one another, undergoing random mutations and inversions of parameters;
- The descendants are sorted out by the best results, and crossing repeats;
- Operations of sorting and crossing repeat until there is improvement of results (the best result among descendants is better than the best one among the parents). The completion of optimization requires absence of improvement of the optimization criterion during several crossings (generations).
Number of Testing Runs
During a genetic optimization, the number of testing runs is much lower, which provides such a quickness of optimization. Once the genetic optimization is started an estimated number of testing runs is displayed at the "Settings" tab. It is calculated according to the following formula:
Population size * (Unconditional number of generations + Number of generations for convergence estimation)
where:
- Population size — it is calculated on the basis of the number of possible combination of optimized parameters, can take values from 64 to 256;
- Unconditional number of generation — can take values from 15 to 31. It is determined by a presence of improvement of the optimization criterion. 15 generations are tested always. If a generation within the range between 15 and 31 doesn't show any improvement of the optimization criterion, an additional testing of the next generations is started for convergence estimation.
- Number of generations for convergence estimation — the number of such generations is calculated as one third of the unconditional number of generations. If the unconditional number of generation is 18 (the 17-th generation has shown the best result and there are no improvements shown by the 18-th generation) then another 5 generations are tested: the 18-th generation hasn't shown any improvement, and for the estimation of convergence we need 18/3 = 6 generations without improvements of the optimization criterion. If there are no improvements shown by the specified number of generations, the testing is stopped.
If the total number of optimization steps exceeds 1 000 000 in a 32-bit system or 100 000 000 in a 64-bit system, the genetic optimization mode starts automatically.
|
All Symbols Selected in Market Watch
Unlike the above described optimization types, this one allows to test an Expert Advisor with the same input parameters but using different symbols. Only the main symbol of testing is changed in each pass, i.e. the symbol of chart the EA would be attached to.
The optimization is performed only with symbols that are currently chosen in the "Market Watch" window. Thus, by adjusting the set of selected symbols, you can manage the optimization.
- Please note that downloading of necessary price data may take a long time. However, the slowdown of optimization as a result of data downloading occurs only during the first launch for a symbol, next time only the missing information is downloaded.
- When optimizing by symbols, the current values of input parameters specified in the "Value" field are used.
|
Optimization Criterion
An optimization criterion 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. Such a factor can be selected on the "Settings" tab, to the right of the "Optimization" field.
The optimization criterion is required only for the genetic algorithm.
|
The following optimization criteria are available:
- Balance max — the highest value of the balance;
- Balance + max Profit Factor — the highest value of the product of balance and profit factor;
- Balance + max Expected Payoff — the value of the product of balance and the expected payoff;
- Balance + min Drawdown — in this case, the balance value and the drawdown level are taken into account: (100% - Drawdown)*Balance;
- Balance + max Recovery Factor — the product of the balance and the recovery factor;
- Balance + max Sharpe Ratio — the value of the product of balance and the Sharpe ratio;
- Custom max — the optimization criterion here is the value of the OnTester() function in the Expert Advisor. This parameter allows using any custom value for the optimization of the Expert Advisor.