What to look out for when assessing trading algorithms

These days most trades are executed by computers being directed by complex trading algorithms. But how do hedge funds use these algorithms and more importantly, how can their efficiency be assessed? Here we discuss the methods by which algorithms are tested to ensure they’re fit for purpose.

What is a trading algorithm?

At its most basic, an algorithm is nothing more than a set of instructions on how to solve a problem. However, algorithms can be utilised to enhance the capabilities of an investment firm by executing pre-programmed trading instructions that will take into account variable factors such as price, timing and volume.

Since they debuted in the 1970s, the popularity of trading algorithms has boomed. In fact, CNN reported that computers make between 50%–60% of all trades on an average day but when the markets are particularly volatile, they can account for up to 90%.

How do trading algorithms work?

Trading algorithms use complex formulas, combined with mathematical models and human oversight, to make decisions in regards to buying and selling securities. Some algo traders will further leverage the power of computerised trading techniques by executing significantly large trade orders in mere seconds, which is referred to as high-frequency trading.

However, there are other trading situations that algorithms can be used for, such as arbitrage and trend trading strategies. While there are certainly some key advantages to using trading algorithms, including fast execution times and reduced costs, there are risks that investors should be aware of, such as their ability to intensify negative market tendencies.

Why trading algorithms need to be tested

Since trading algorithms are such an integral part of many investment strategies, it’s imperative that an algorithm works exactly as it’s supposed to. If something goes wrong, it could cost investors a lot of money. But what exactly should an algorithm be tested for?

Firstly, the general reliability of the algorithm itself needs to be checked before it starts executing live trades. Trading firms also need to know that they can count on the infrastructure propping the algorithm up, such as the computer software that’s running in the background. Furthermore, the finer details of the algorithm will need to be fine-tuned to ensure maximum efficiency and speed of execution.

How to test a trading algorithm

One of the most frequently used methods for assessing an algorithm is backtesting. This essentially tests how well an algorithm would have performed based on historical data. Backtesting requires a continuous flow of data such as last traded price (LTP), last traded quantity (LTQ) and market depth. This can, however, be replicated by a simulator.

By replicating continuous data, backtesting can be used to identify how several strategies would work under different conditions. Algorithmic strategies can be classified by the complexity of the business functionality, but the more complex an algorithm is, the greater the risk on performance and profitability.

Because the very point of a trading algorithm is to react to a number of variable factors based on market movements, testing an algorithm is no easy feat. In order to run these tests effectively, the algorithm will need to be put through several different scenarios.

What to look out for when testing

While backtesting an algorithm should be a high priority for algo traders, backtesting a strategy isn’t always straightforward. For example, as a strategy’s frequency increases, it becomes more difficult to accurately model the microstructural effects of the markets.

This makes the backtesting less reliable over time, making it harder to evaluate the overall strategy. This can be particularly problematic where system execution is key to the performance of a strategy, such as high-frequency algorithms.

So while trading algorithms should always be backtested, it’s worth knowing how certain biases may appear as a result of the tests – and how these may affect the performance of an algorithm on a live market.

Optimisation bias

Optimisation bias usually occurs when trading parameters are either added or adjusted until the backtest data is particularly attractive. The issue here is that once it goes live, the performance of the algorithm might be very different. To avoid this one should minimise the parameters and increase the number of data points

Look-ahead bias

When future data is included in error at a point in the simulated data where it shouldn’t be, you end up with look-ahead bias. Such biases can be hard to spot and may be the result of bugs or parameter errors. However, it’s important to avoid its introduction as it may result in an algorithm underperforming its backtest data when it's live

Survivorship bias

Similar to look-ahead bias, survivorship bias usually occurs as a result of backtesting an algorithm against data sets that don’t account for the entire ‘universe’ of assets that may have been chosen at a particular time, but rather the assets that ‘survived’ to the current time.

For example, if a strategy was tested on a random pool of equities before and after the 2008 financial crisis. Many companies went bankrupt while others ‘survived’, but if the data set was restricted to stocks that survived the crisis, a survivorship bias would be introduced as the stocks have already demonstrated their success

There is then, a lot to consider before letting an algorithm trade on a live market. However, if an algorithmic trading strategy is to succeed, running efficient tests is imperative.

Publication date: 2022-04-14T16:40:59+0100

This information has been prepared by IG, a trading name of IG Markets Limited. In addition to the disclaimer below, the material on this page does not contain a record of our trading prices, or an offer of, or solicitation for, a transaction in any financial instrument. IG accepts no responsibility for any use that may be made of these comments and for any consequences that result. No representation or warranty is given as to the accuracy or completeness of this information. Consequently any person acting on it does so entirely at their own risk. Any research provided does not have regard to the specific investment objectives, financial situation and needs of any specific person who may receive it. It has not been prepared in accordance with legal requirements designed to promote the independence of investment research and as such is considered to be a marketing communication. Although we are not specifically constrained from dealing ahead of our recommendations we do not seek to take advantage of them before they are provided to our clients. See full non-independent research disclaimer and quarterly summary.

All trading involves risk to capital.

Contact us

Let us create a solution tailored for your needs. Get in touch with our London-based team by phone or email to discuss your objectives, or request a brochure.

Please include the country code if outside the UK

By clicking Request a brochure you agree to the terms of our access policy.