Menu

Wednesday, December 7, 2016

Testing and Analysis of Algorithmic Trading Strategies in MATLAB (Part 4) – Genetic Algorithms

This post is about how important is to use different types of optimisation methods such as genetic algorithms and parallelisation to get results faster.

Genetic Algorithms Optimisation


Despite the fact that the genetic (evolutionary) algorithm principle is very well explained in the MathWorks webinars, in the examples, however, it is used only for optimisation of the choice of a strategy group from a set. This is a good example of the use of these algorithms, however, it happens that there is a need to set many variables with significant intervals for one strategy, you don't get by with one iteration and the parallelisation of processes – calculations can take several days. Certainly, there are strategies in the final stage of optimisation, when we almost surely know the trading strategy is successful, we can wait for several days as well or rent the whole cluster - the result might be worth it. However, if we need to "estimate" the results of a "bulky" strategy and decide if it is worth it to spend the time, then genetic algorithms may be perfectly suitable.

We provide the possibility to use three methods to optimise the strategy in WFAToolbox:

  • Linear method – it is a usual mode of sorting in which you will see all intermediate (suboptimal) results. It gives maximum accuracy.
  • Parallel method – all kernels of your CPU will be used. It does not allow to see intermediate results, but significantly speeds up the operation. It gives maximum accuracy during increase of computation speed.
  • Genetic method – it uses the evolutionary optimisation algorithm. It allows to see suboptimal values, but gives the result close to the best. It's not a very accurate method, but it's precise enough for the initial "run" of the strategy. Very fast.

genetic algorithms with MATLAB
Genetic Algorithms


We are often asked if WFAToolbox - Walk-Forward Analysis Toolbox for MATLAB has the ability to use the GPU in calculations. Unfortunately, GPU is not suitable for all tasks and its use is very specific. In order to use it, you need to adjust the logic and the code of each strategy for graphic cores testing. Unfortunately, due to such non-universality of the method one cannot use GPU in WFAToolbox.

No comments:

Post a Comment