# #059: GENETIC OR “CLASSICAL” OPTIMIZATION?

For some reason, many beginning traders have a fear of using genetic algorithms (GA) to optimize their systems. However, it is obvious that classical (exhaustive), as well as modern (genetic) optimizations play their part in strategy development. Today I will try to explain what differences both types of optimization can offer and help you see that you don’t have to be afraid of “genetics”.

The biggest advantage of genetic optimization is, without a doubt, time. Especially if we have more parameters to optimize, we can literally shorten the whole process from days to only a few hours – which is an acceleration worth thinking about.

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

First of all, in a surprisingly high amount of cases, genetic algorithms can find completely similar combinations which classical optimizations would find as well. Secondly, it can find combinations that can differ. This can be helpful, as I will explain shortly.

Let’s start with a simple comparison that shows rather realistic solutions found by GA - how close or how distant they are to 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 used data into 7 segments and I have carried out 7 optimizations (one on each segment of data) to have more samples to compare. The comparison turned out as follows:

First of all, I have marked in yellow the parameters that GA found exactly the same as the classical method of optimization. From the picture it is obvious that it was in more than half of the cases – 54%. That isn’t bad at all, especially if we take into account the reduction of the original time needed for optimization is of 90-95%. Afterwards, I have marked in red the parameters GA found as very close to those the classical optimization technique found – the outcome shows there isn’t any noticeable difference. Yellow and red fields add up to 69%, which is a pretty decent result. In almost 3/4 of the cases, the results from GA were the same or very close to those where the classical optimization was used. However, GA found solutions in 5-10% of the time than what was originally needed.

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

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

What exactly are these?

Imagine you have two parameters – N1 and N2 – and you would like to find a combination with the best profit. You carry-out an optimization which you can afterwards display in a 3D chart:

As you can see from the picture, the best combination shows profit at around the level of 130,000 USD. The problem is that this optimum is local, and not global. The local optimum doesn’t show similar results in the immediate vicinity. In other words, there is only one combination that provides great results, but any surrounding combinations will not. Local optimum is with a high probability over optimized combination and a classical optimization technique tends to search for local optimum.

Unlike genetic algorithms which are going for global optimum. I have marked such area in the picture with an arrow. As you can see, in this area the profit is around 110,000 USD, but optimum has many functional “neighbours”. Therefore, global optimum is more robust than local optimum (which earns more, but the combination of parameters is from the robustness point of view disputable).

Naturally, genetic algorithms don’t always hit global optimum and occasionally they also include a local optimum in their solutions. At the same time, classical optimization doesn’t always produce only local optimum – oftentimes, the best combination is part of a global optimum (and these are the moments when in all probable solutions found by GA and classical optimization will correspond or will be very close). Unfortunately, genetic algorithms also use the element of chance, so the final result is substantially less controllable – well, this is the price to pay for the acceleration of optimization.

Personally, I use both types of optimization and I think that both have their places in the development of ATS. Genetic algorithms may seem scary at the beginning, but once you carry out a few tests and you get used to them, you will realize that they are an irreplaceable help in many cases, and with their help you will do much more work. Of course, there are tons of academic studies discussing aspects of both optimizations. We could polemicize about anything in regards to both methods – but I personally am not an academic; I am a pure practitioner. From the practical point of view GA, can be really priceless, especially when used in a sensible and smart way. Therefore, there is no need to be afraid of them but it is important to use them with sense and reason.

Tomas

##### Author: Tom Nesnidal (more about me)
###### What others are saying

"Tomas is one of the most creative traders I know. He is able to generate unique trading ideas and elegant solutions to system development challenges."

"Tomas has been a professional trader for more than a decade and I have had the privilege of monitoring his accounts in action since 2006. His systems are performing as some of the best I have ever monitored and executed. I have been in the trading industry since 2002 and worked with many developers from all over the world. Tomas is definitely the one to consider."

Martin Lembak,

MFRM, CAIA

"Tomas is a professional trader, who for the last 10 years has specialized in developing trading systems. We have been tracking his trading systems for about 5 years and they generally show very robust, stable and above average performance. Striker is pleased to work with someone like him - a real professional with enthusiasm and deep knowledge of trading."

William Galwas, President Of Striker Securities, Inc

"Personal consultation with Tom helped me to re-evaluate the complexity of my robustness testing and optimization processes. Plus, it has helped me with a specific plan on how to take things forward. It has given me some great ideas on how to avoid overfitting and make my testing more robust and provided tips on low hanging fruit in terms of the best markets to trade for intraday/short-term breakouts."

Craig Peters,

United Kingdom

"Tom's approach to Automated Trading Strategies design, tests of robustness and portfolio diversification is really unique. He has been a professional trader for many years and the depth of his understanding of Breakout strategies and Market Internals is hard to find elsewhere."

Antonin Fisher,

Hedge Fund Manager,

Czech Republic

"Tom´s systems and trading approach do really work and can bring good, stable and reasonable returns. I can highly recommend him as a teacher."

David Hruby,

"Tomas is truly an inspiring mentor and great trader with a positive life attitude. He has got very deep understanding of markets, breakout strategies, robustness testing procedures, and Market Internals."

Jan Lesanovsky,

Client, United Kingdom

"As an experienced trader, I used Tomas´s consultation to get more clarity on best-practise robustness testing procedures, risk management, and portfolio management. He was quickly able to help me refine my current trading and system development approaches, and pointed me to really practical measures that I could implement immediately. I found Tomas to be not only extremely knowledgeable but very helpful and a great teacher. This has given me more confidence in developing robust strategies that work, and I would recommend his mentoring as extremely valuable for any systems trader."

Trevor West,