Optimising Trading Strategies by Using a Genetic Algorithm

How to use the theory of evolution to enhance the performance of your trading strategy

Danny Groves
Geek Culture

--

Photo by Johannes Plenio on Unsplash

If you’re interested in trading, then you have more than likely seen a bunch of strategies based on technical analysis indicators. Sadly, most of these standard strategies do not work, and effort needs to be placed into optimising your strategy for certain sectors and/or market conditions.

One pretty awesome method to optimise a strategy is by using the theory of natural selection by using a genetic algorithms. Essentially, this algorithm works by:

  • Taking n traders who use a certain strategy, and evaluate their performance.
  • Keep the best x% of strategies (I use 30%) and eliminate the remaining 100-x% (sounds brutal…).
  • Generate new traders by either randomly, or by combining (breeding) good traders.

Sound familiar? This is survival of the fittest. We want to run this above procedure many times to produce the strongest traders, and disregard any who produce mediocre results!

As an example, here is an equity curve I produced through a quick optimisation of a simple moving average crossover strategy. The optimisation was performed on other companies in the…

--

--

Danny Groves
Geek Culture

Mathematics PhD & Data Scientist | Pythonista | Learning algo/quant trading. Sharing my discoveries and mistakes. No posts are financial advice.