Python Parameter Optimisation for TA-Lib Trading Strategy

AAA Quants
9 min readAug 28, 2020

How to test a trading strategy and optimise its parameters

Introduction

A vital step in quantitative research is finding the best parameter sets for a trading strategy. Having a set of (near) optimised parameters might distinguish a winning strategy from a mediocre one. This is often unappreciated and results in underperforming trading strategies.

In this Python tutorial, we will build some codes and automate the process. I’ve chosen a simple Moving Average Crossover strategy as an example. You will see that there is more than meets the eye. During this process you will learn some facts that may surprise you.

I have often been asked the question: why not use the tools conventionally available in machine learning and AI? My answer is twofold: first the danger of overfitting is indeed so high for financial time series, that these tools simply do not apply. Second, for someone familiar with the dynamics of trading, most of the computer generated models do not make sense even by the most unconventional, open-minded standards and their performance is expectedly poor.

--

--

AAA Quants

AI, Quantitative Analysis and Data Science Solutions for Finance