Algorithmic trading: What is it and how does it work?

Raise your investing game by being able to trade at speed and without emotional bias

young man using a laptop, sat at home
Trading platforms no longer require a knowledge of coding to build algorithms Credit: Milan Markovic/E+

What silently pulls the levers and gives liquidity to markets? Automation and complex algorithms trade securities at a blistering speed, shaping financial exchanges – and investors can use this algorithmic trading to their advantage.

Here, Telegraph Money explains what algorithmic trading is and how it works in live markets.

What is algorithmic trading?

Simply, algorithmic trading is the use of computer functions to automatically make trades in financial markets.

The algorithms are pre-programmed to execute buy and sell orders based on certain variables, or a set of variables, taking place without human intervention.

In forex markets, roughly 90pc of trades are done using algorithms. In equities, roughly 60-75pc of trades in American, European and Asian capital markets are done through pre-programmed functions.

How does it work?

An individual or, as is predominantly the case, an institutional investor will use automated algorithmic strategies to execute trades.

Institutional investors dominate the space through sheer position size, placing large trades to reduce transaction costs.

Given that size, one large trade from a hedge fund or investment bank has the ability to disrupt the market. Algorithmic trading can break up that trade into smaller increments to be deployed at coordinated times.

For instance, an order of 1 million shares would send a strong signal to the market, whereas an algorithm trading instruction of 1,000 shares every 15 seconds is more palatable and, in some cases, less noticeable.

How to use algorithmic trading

Initially, algorithmic trading can appear daunting. Indeed historically, trading platforms required a knowledge of coding to build the algorithms.

Now, platforms cater for those with minimal coding experience and a degree in computer programming isn’t necessary.

To use it, the first step is to gain an understanding of common algorithmic strategies, such as trend-following, mean reversion, high-frequency trading and arbitrage (more on these later).

Then develop a strategy based on data and knowledge of the market. Consider: how will the algorithm react to certain trading signals? What has to happen for it to place orders according to those signals?

Backtesting the algorithm – that is testing it using historical data – may not be necessary for a pre-existing algorithm. That said, thorough testing of how the algorithm works and its suitability for live markets is key.

Like all trading strategies, implementing good risk management, like stop-losses, position sizing and diversification, is essential.

Advantages

Without a doubt, the biggest benefit of algorithmic trading is the speed and efficiency of deployment. Trades can be made at an incomprehensible speed and in an arena of high-frequency trading – this is invaluable.

The speed of data processing also greatly improves decision-making and execution, fixing the problem of markets changing before you manage to make a trade.

Algorithms are set by defined parameters and will stick to those parameters, taking human emotions out of the equation. Clearly, emotional bias can weaken decision-making when acting out of fear or greed.

Automation also allows for efficiency by taking advantage of smaller price movements. Algorithms are used in market-making strategies that narrow the bid-ask spread, therefore benefitting both the trader and overall market.

These functions are not static one-rule solutions. You can build effective quantitative models that can handle and combine different strategies, like statistical arbitrage, alongside machine-learning models that would be near-on impossible to manage manually.

Disadvantages

Algorithmic trading can act as a double-edged sword. An over-reliance on automation can be dangerous given the set parameters in which algorithms operate, and unexpected events like a bubble or crash can expose the inflexibilities of code. Such an event would be what is known as a “flash crash”.

In May 2010, high-frequency trading algorithms triggered a plunge in major indices, although all bounced back sharply.

The Dow Jones Industrial Average (DIJA) plunged roughly 9pc in minutes and, despite rebounding, wiped $1 trillion of market value.

A general election in the UK and financial issues in the Greek economy negatively affected markets, pushing equity and futures indices downwards.

An already fragile situation was compounded by a large number of trades in E-Mini S&P contracts and other high-frequency trades in futures that pushed indices to freefall.

A British trader was convicted of using “spoofing” algorithms, which create the illusion of demand to manipulate the market. The programme created a large number of selling orders of E-Mini S&P contracts to artificially push prices down, which led to the market plunge.

The trader was convicted and this kind of market manipulation is now banned to prevent a repeat of May 2010.

There is also an issue of adaptability. “Black swan” events, geopolitical upheaval and even natural disasters can upend an algorithm which is trained on historical data. Often these events or unique combinations of events have no precedent and can expose inflexibilities.

A point, too, on transparency. Markets are being shaped by complex algorithms all working in tandem to move the dial of asset pricing. Despite efforts to prevent market manipulation, strategies are evolving all the time.

It also gives an unfair advantage to the large institutional players who have the capability to run these complex algorithms and gain speed and price advantage over other investors.

Algorithmic trading strategies

Trend following

This involves using technical indicators to follow market trends. I covered this in a piece on swing trading and the various technical indicators a trader could use.

A moving average, or different momentum indicators like relative strength index (RSI) are quite common.

HFT

High-frequency trading, or HFT, can make multiple trades in a fraction of a second, making large orders with small profit margins. A trader would seek to profit from the spread between the bid and the ask price.

These market-making strategies supply the markets with ample liquidity by continuously quoting the buy and sell prices.

Mean reversion

This strategy assumes that asset prices return to their historical average and an advantage can be gained when an asset is either undervalued or overvalued compared to its long-term equilibrium price.

Arbitrage

Price discrepancies often occur and arbitrage strategies exploit the differences in related markets or assets. Statistical arbitrage, or pairs trading, identifies two correlated assets and takes opposite positions when the price relationship deviates.

For example, go long on the undervalued stock and short on the overvalued one, under the assumption that the prices will converge.

A common example here is Pepsi and Coke, since both are established players in the same industry. If the price of Coke goes up and Pepsi remains static, a trader would short Coke and go long on Pepsi.

Algorithmic trading FAQs

Is algorithmic trading profitable?

Like all trading strategies, there can be considerable profit when executed well and with effective risk management built in. However, institutional players hold a lot of the cards here, and a retail trader would need considerable experience and a sophisticated algorithm to make consistent profits.

That said, it all comes back to price inefficiencies, and if an investor understands how prices correlate and relate to others, then algorithmic trading can be a profitable venture.

How much does it cost to start?

For a large institution like a hedge fund, tens of thousands or millions of pounds can be spent on the design, implementation and execution of their algorithms.

Individual traders can either build their own algorithm or use platforms that provide code, and will need a balance to trade, depending on experience and risk appetite.

Profits, however, can be eaten up by platform fees, software subscriptions and potential data requirements for algorithmic trading, which is worth considering beforehand.

Is algorithmic trading legal in the UK?

It is certainly legal, but certain practices are not. Tactics such as spoofing, which led to the 2010 flash crash, and layering, are illegal.

Layering is another high-frequency market manipulation tactic that influences the price of an asset.

Say the current price is £100. A trader places large orders to buy 10,000 shares at £101, then more at £102 and £103. These orders are visible to those trading and can be seen as strong demand ticking upward leading more to start buying.

The trader then cancels the orders once the price has moved upwards and will then buy the stock, profiting nicely from the price move.

Conclusion

With fewer barriers to entry, it’s easier now to be an algorithmic trader than it has ever been.

Success in this area is dependent on a thorough understanding of different high-frequency and arbitrage strategies in relation to market dynamics.

Automation may be good for efficiency, but less so for transparency, and while algorithmic trading does a lot of heavy lifting in the background, markets change rapidly and backtested strategies that work today could look outdated tomorrow.