For whatever reason, many beginning traders are afraid of using Genetic Algorithms (GA) to optimize their systems. However, it is obvious that classical (exhaustive) as well as modern (genetic) optimizations play their role in strategy development. Today I will try to explain to you what differences both types of optimization can offer and help you to see that there is no need to be afraid of “genetics”.

The biggest advantage of genetic optimization is undoubtedly time. Especially if we have more parameters to optimize, we can literally shorten the entire process from days to just a few hours, which is a speedup worth thinking about.

Most traders who do not have any experience with genetic optimization have a feeling that thanks to this shortcut, the whole process will somehow be like “cheating”. After all, how is it possible that GA can find solutions in 5-10% of the normal time, when the classic optimization process takes “full” time?

First, in a surprisingly high number of cases, genetic algorithms can find completely similar combinations to those that classical optimizations would also find. Second, you can find combinations that may differ. This can be useful, as I’ll explain shortly.

Let’s start with a simple comparison that shows quite realistic solutions found by GA: how close or how far they are from the solutions that classical optimization would find.

In this article I have chosen as an example a system of mine with 5 optimization parameters in total and on which I have applied Walk Forward Optimization (WFO). It means that I have divided the used data into 7 segments and have performed 7 optimizations (one on each data segment) to have more samples to compare. The comparison turned out as follows.

First of all, the parameters that GA found exactly the same as those of the classical optimization method – in more than half of the cases – 54%. That’s not bad at all, especially considering that the reduction of the original time needed for optimization is 90-95%. Subsequently, the GA parameters were found to be very close to those found by the classical optimization technique: the result shows that there is no noticeable difference. The two groups together add up to 69%, which is a pretty decent result. In almost 3/4 of the cases, the GA results were the same or very close to those in which classical optimization was used. However, GA found solutions in 5-10% of the time originally needed.

The remaining 31% of results differ fundamentally, which can be a bit of a concern for some people. But as I will explain later, there is no need for that.

Usually the reason for a difference between the results is that classical optimization searches for the so-called local optimum and genetic algorithms tend to find a global optimum.

What exactly are these?

Imagine that you have two parameters, N1 and N2, and you would like to find a combination with the best profit.

The best combination shows profit for this case around the level of 130,000 USD. The problem is that this optimum is local and not global. The local optimum does not show similar results in the immediate vicinity. In other words, there is only one combination that gives great results, but the surrounding combinations will not. The local optimum has a high probability of an optimized combination and a classical optimization technique tends to search for the local optimum.

Unlike genetic algorithms that search for a global optimum. In this area, the profit is about 110,000 USD, but the optimum has many functional “neighbors”. Therefore, the global optimum is more robust than the local optimum (which gains more, but the combination of parameters is debatable from a robustness point of view).

Naturally, genetic algorithms do not always reach the global optimum and occasionally also include a local optimum in their solutions. At the same time, classical optimization does not always produce only a local optimum; often the best combination is part of a global optimum (and these are the moments when all the probable solutions found by GA and classical optimization will correspond or be very close). Unfortunately, genetic algorithms also use the element of chance, so the end result is substantially less controllable; well, this is the price to pay for optimization acceleration.

Personally, I use both types of optimization and believe that both have their place in ATS development. Genetic algorithms may seem scary at first, but once you do some tests and get used to them, you will realize that they are an irreplaceable help in many cases, and with their help you will get much more work done. Of course, there are tons of academic studies discussing aspects of both optimizations. We could argue about anything regarding both methods, but personally I’m not an academic; I am a pure practitioner. From a practical point of view, GA can be really invaluable, especially when used sensibly and intelligently. Therefore, there is no need to be afraid of them, but it is important to use them with sense and reason.

Happy trading!

Leave a Reply

Your email address will not be published. Required fields are marked *