Beginner
Now you are reading
How to go about optimizing slots?
0

How to go about optimizing slots?

created Paweł MosionekAugust 21 2013

If we decided to play with an automatic strategy, we came up with an idea how it should work and we created it algorithmthat has been tested on historical data, half of the work has already been done. If the back tests were positive and the Expert Advisor implements our assumptions and achieves satisfactory results, you may be tempted to optimize the results. Just because it's good doesn't mean it can't get any better. However, you have to be careful not to overdo it and not go to extremes ...

Slots optimization

Using the MetaTrader 4 platform, we have at our disposal Historical testerwhich allows you to check how the strategy has behaved in the past. This tester is also equipped with an optimization module, which will compare the results with various combinations of parameters selected by us, taking into account our priority criterion. Metatrader 4: Strategy TesterIn the main configuration window Strategy properties we can choose the most important parameter that will be taken into account when making optimization. With the genetic algorithm selected, summaries of results will be created through the prism of it. The genetic algorithm itself means that the platform will only test some of all combinations. Those considered irrelevant will be ignored. This feature is extremely useful because it does not deteriorate the results and at the same time reduces the testing time.

In the tab with the parameters, 4 columns are shown:

  • Value,
  • Start,
  • Step,
  • Stop.

In the first one, a value is entered for a given variable, which will be taken into account in the normal backtest. The next columns are already concerned with optimization. The start is the extreme lower value from which the parameter will be optimized. Step is the degree of its increase at the next attempt, and Stop is the value with which the test will be terminated.

Metatrader 4: Strategy TesterThe smaller the step and the greater the interval between the Start and Stop values, the more combinations to optimize and the test will last longer. In addition, the more variables will be optimized (remember to mark it in the square on the left), the test will run even longer.

The last tab OPTIMIZATION contains filters that will automatically reject results that do not meet the given criterion.

Watch out for over-optimizing

It is easy to over-optimize by selecting multiple parameters for optimization and selecting large ranges with a minimum step in one go. If we select all the parameters and give a large range of values, a whole lot of tests will be performed. At first, you might think it's great. Many results, various configurations - there will be plenty to choose from. True, but it will be difficult to choose. It will also result in many strange combinations. Unequal values ​​or some will be extremely large, and others extremely small and logically meaningless will be meaningless.


READ ALSO: How to run a Forex slot machine (Expert Advisor)


If we decide to optimize several variables at the same time, it is worth choosing them so that they are similar to each other. Therefore, we combine values ​​such as Stop Loss, Take Profit or Trailing Stop and add them to one test. The second is the periods and types of moving averages or other indicators used.

The optimization intervals also need to be reasonable. The best values ​​alone should not change by 1 or even 0.1 points. Due to this approach, the result will usually also be very strange, and we will adjust the parameters perfectly to the historical data. The problem is that we will not be playing history but the real market. It is true that the system must be adapted to its characteristics, but some rounded standards will make sense of the parameters.

It is also a good idea to perform tests on shorter time intervals instead of immediately on the entire history we have access to. If we do a test on interval H1 you can do some optimizations after 3 months and see if the parameters actually match. If so, then they can be checked throughout the period or find a compromise.

Expert Advisor - optimization results

After doing his job, the strategy tester will throw away all the results or selected, relevant results (with the Genetic Algorithm selected). All of them will be available in the tab The result of optimization.

Metatrader 4: Strategy Tester - Optimization Result

Here is a description of the combination of parameters and the test results using them. The optimization results can be saved to disk. The settings, in turn, can be immediately loaded into the strategy properties in the backtester by double-clicking on them.

Additionally in the tab Optimization graph the results are presented in the form of a graph, where for each combination number the achieved profit is crossed out, thanks to which it is easy to search for perspective settings.

What do you think?
I like it
Present in several = 25%
Interesting
Present in several = 67%
Heh ...
0%
Shock!
0%
I do not like
0%
Detriment
8%
About the Author
Paweł Mosionek
An active trader on the Forex market since 2006. Editor of the Forex Nawigator portal and editor-in-chief and co-creator of the ForexClub.pl website. Speaker at the "Focus on Forex" conference at the Warsaw School of Economics, "NetVision" at the Gdańsk University of Technology and "Financial Intelligence" at the University of Gdańsk. Twice winner of "Junior Trader" - investment game for students organized by DM XTB. Addicted to travel, motorbikes and parachuting.