Search

Algorithmic Trading Strategy Building Process – 2024 Road Map!

quantitative trading strategy building process

Create an Algorithmic Trading Strategy Factory, that’s the goal of this tutorial. Explain to you, all the steps that you need to follow to improve your methods and take your trading to the next level.

For a lot of you, algorithmic trading is taking fix time bars, apply technical indicators and use a simple backtest. It ends today! That’s today that you will see how professional quant traders create their algorithmic trading strategies.

Data import, data preprocessing, features engineering, trading strategy development, backtesting, robustness tests, live trading, monitoring, portfolio management, … You will learn how to organize all these steps like the pros and the underlying challenges of each one.

1. DATA IS THE FOUNDATION OF ANY ALGORITHMIC TRADING STRATEGY

For a lot of us, we focus all our attention on the trading strategy, optimizing the entry and the exit points but, that is a huge error. Indeed, data is the most important part of any algorithmic trading project. The most annoying frequently but, still the most important.

Data is your heart edge: the more you are using difficult-to-handle data, non-obvious data, or difficult to obtain data, the better your edge will be and the longer you will keep it! Never forget one of the most famous quotes in data science: ‘Garbage In, Garbage Out’, which explains that your performance doesn’t depend only of your model but more of the data you are using.

Always use several data sources for the assets you are trading (when it is possible). It is the easiest way to find the wrong quotations.

Let me give you a list of challenges the Quant specialized in this area have to deal with:
  • Import alternative data (detailed in the monthly projects 1 & 2 of the Alpha Quant Program)
  • Deal with datasets with millions of rows like ticks data (detailed in the monthly project 3 of the Alpha Quant Program)
  • Clean datasets combining different data sources (detailed in the monthly project 4 of the Alpha Quant Program)
  • Manage the data taking into account the compliance rules.

FEW TIPS:

  • Take a look to the .parquet files instead of the .csv.
  • A lot of data is free when you know where to find them.
  • Start creating strategies with the data you have and then increase your database slowly, no needs to have 100TB of financial data to begin working on your algorithmic trading strategies.

2. FEATURES ANALYSIS - THE ART OF EXTRACTING INFORMATION

That is amazing to have a large trading dataset, but we need to use it now… That’s the next step: the algorithmic trading features engineering step. You will take your cleaned data and try to understand them (detailed in the monthly projects 5 & 6 of the Alpha Quant Program).

The feature analysts work generally using only a part of the data in order to do not integrate look-ahead bias in the process. If we have 10 years of data, we can take the first 7 years to extract information. The last 3 years will be used in the backtesting and robustness step.

FIGURE: EXEMPLE OF THE 1ST PAGE FROM ONE OF MY REPORTS

report talking about a trading strategy
To extract interesting information from this data, the feature analyst needs to have a good understanding of the data analysis tools and methods but also about financial markets to understand the signification of the features he is creating. At this end of this step, you should have new signals additionally to your current database. 
 
Let me give you some example of features engineering from this part, each output is called a signal (different from a strategy which uses several signals and methods in the same time):
  • You take the bid and ask volume from the ticks’ data to create a new feature highlighting that, when the bid volume because close to 0 with an important ask volume, the odds to have an upward movement is not 50%-50% anymore but 56%.
  • You are able to analyze the current news thanks to the ChatGPT API and you found that when you have 2 news that your model predicted as bad and the price has decreased, the odds that a 3rd news predicted as bad news, the odds that this news impacts negatively the market is higher.

The goal of the feature analyst is not to create the trading strategy, but to understand them and summarize all the information in the best way possible for the next step.

3. ALGORITHMIC TRADING STRATEGY DEVELOPMENT

At this step, we have a clear and clean dataset and some signals that come from it thanks to the feature analysis step. The goal of this 3rd step will be to create a clear trading strategy using this signal. We don’t want some relation like in the previous step. (detailed in the monthly projects 7 & 8 of the Alpha Quant Program)

We need clear entries, clear exits, money management rules, … So, all the things that we will do in order to analyze the strategy need to be written in a paper. The goal is really simple, avoid making mistakes. The more you will write your strategy and verify it, the fewer errors you will do. And obviously, if you want to share your strategy, explaining what you do for each step and why you do it, you need to write it down: only a code is not enough.

In algorithmic trading, there are two “schools”, the one who thinks that you always need a logical or economic theory behind a strategy (Marco Lopez De Prado for exemple) and the ones who think that statistical proof are enough (Jim Simons). There is not one true answer, both work and have advantages and weaknesses. I will talk more about that in another article.

Let me give you an example of algorithmic trading strategy to make you understand the difference better with the step number 2:

  • Thanks to the features analysis step, we are able to detect a long-term market conditions switching 3 days in advance with a 70% of accuracy. The theory is really simple, the news traders didn’t live and practice a lot of these market conditions switching, they will increase their stop loss thinking that is a just a fluctuation and they will make your profits. Thanks to another signal, we have seen that it is better to quit our position 1 day after the market condition switch. To respect a strict money management, we will adapt our volume to do not have a stop loss lower than -0.20% of our capital with a trailing stop loss to capture our earnings.

4. TRADING BACKTEST & ROBUSTNESS TESTS

We now have a trading strategy, but nothing says that it is a profitable one. We need to verify several things: performances and robustness. The performances are verified through a backtesting Walk-forward Optimization and robustness using different methods like Monte-Carlo Simulation, CPCV, … (detailed in the monthly projects 9 & 10 of the Alpha Quant Program)

When we do a professional backtest, we generally take into account the number of strategies tested on the same dataframe to discount our results.

So, to backtest our strategy, we will use a Walk-forward optimization because it has several advantages: optimize the parameters of the strategy while we backtest it, we have several train/test split points which reduce the variability of the results and the test period is much longer than with a simple backtest.

Moreover, once we have the performance of the strategy, we need to verify the overfitting risk. To do that, we use the robustness tests. Indeed, they will help us to understand the probability of overfitting and also how our results vary.

FIGURE: BACKTEST + ROBUSTNESS TESTS EXEMPLE

Backtest of a trading strategy using Python. It show a clear upward trend in the results
Robustness test of a trading strategy using Python.

Join Our Newsletter

Be the first to receive our latest quant trading content (personal notes, discount, new articles).

5. LIVE ALGORITHMIC TRADING - DEPLOY YOUR STRATEGY

If we are here, it means that you have a profitable trading strategy “in theory”. We need to make it pass the live trading test now. Indeed, nothing is better than a real-life test. (detailed in the monthly projects 11 & 12 of the Alpha Quant Program)

Fortunately, this step is one of the easiest (expected for High Frequency Trading and Scalping methods), because in a few lines of code, you can automate your strategy. In the Alpha Quant Program, we use MetaTradr 5, but it works nearly the same for all the platform.

However, even if this step is easy on the technical side, it stays one of the most critical, because it is there that we will say if we keep or not our trading strategy. First, we use a demo account to understand if we do not have made any errors, then a live trading account with a small capital to analyze the impact of spreads and commissions. And it is only after all of that, you can put your strategy in live trading with the capital you want (according to your trading strategy portfolio).

Never forget to monitor the eventual errors and performances of your strategy. If you have any technical errors, it is good to know to fix it ASAP. If you see that the strategy performance is shifting to much from the expected performance, take a look deeper about why?

6. PORTFOLIO MANAGEMENT

If you are in this step, it means you already have several trading strategies. So, you have made 95% of the work. Indeed, this step is not mandatory but very well advised to reduce your risk. (detailed in the monthly projects 13 & 14 of the Alpha Quant Program)

The goal of the trading strategy portfolio step is to stabilize the returns reducing the risk. It is not in this section that we will turn a 30%/year return trading strategy into a 100%/year one. But it is there that you will reduce considerably the risk on your capital.

Indeed, this step will help you in several ways:
  • Create and diversify your portfolio in order to reduce your drawdown.
  • Understand which strategy is the riskier (not always the one with the highest drawdown).
  • Make dynamic adjustment to rebalance your portfolio weights.

When you have several strategies, you will see that several are very correlated which is not so interesting in terms of reducing your risk. So, to still put this new strategy in your portfolio. Take the strategies highly correlated with the new one, reduce their weights in the portfolio to give them to your new strategy.

FIGURE: SINGLE STRATEGIES VS PORTFOLIO OF THEM

show the returns of singles trading strategies and the equal weighted portfolio of them

It was a very dense article, with a LOT of new things to learn. Do not use it like a tutorial where you follow each step blindly, use it like a road map: make some deeper research about each step. Moreover, do not forget to practice a lot each step until you master it 100% to avoid the stupid errors (I was the best for that at the beginning).

Join Our Newsletter

Be the first to receive our latest quant trading content (personal notes, discount, new articles).

Lucas Inglese

Lucas is a self-taught Quantitative Analyst, holding degrees in Mathematics and Economics from the University of Strasbourg. Embarking on an independent learning journey, he delved deeply into data science and quantitative finance, eventually mastering the disciplines. Lucas has developed numerous bots, sharing his insights and expertise on LinkedIn, where he regularly posts content. His understanding and empathy for beginners in this complex field led him to author several books and create the comprehensive “Alpha Quant Program.” This program offers e-learning videos, monthly projects, and continuous 7-day-a-week support. Through his online courses and publications, Lucas has successfully guided over 67,000 individuals in their pursuit of knowledge in quantitative finance.

Related Posts

Scroll to Top