Algorithmic Trading – Introduction to automated trading with algorithms

Algorithmic trading, artificial intelligence and automation have changed the financial markets

Algorithmic Trading
Image Source: whiteMocca / Shutterstock.com

Algorithmic trading refers to trading strategies that are automated, both in terms of identifying and executing trades. The increased use of automated trading systems fits into the general trend toward automation in most industries. However, algorithmic trading is more than just a more efficient way to enter orders. The entire research and trading process can benefit from automation, computing power and new fields like artificial intelligence.

What is algorithmic trading?

Definition Algorithmic Trading
Image Source: qimono – Pixabay.com / License: CC0 Public Domain

Algorithmic trading strategies follow a rule-based system to select trading instruments, identify trading opportunities, manage risk and optimize position size and capital use. In most cases systems are automated so that entries and exits are executed by the algorithm too. The terms systematic trading, electronic trading, black-box trading, mechanical trading, and quantitative trading can at times be used interchangeably with algorithmic trading.

A very simple example of an algo trading system would be one that buys an instrument if its 20-day moving average cross above its 50-day moving average and sells the instrument when the 20-day moving average cross below the 50-day moving average. The system would then execute and manage the trade. In reality most trading systems are far more complex than this, but they still follow a systematic, rules-based approach. 

Algo trading can be applied to any tradable asset class, though it is best suited to liquid instruments that trade on exchanges or in active interbank markets. For this reason, algo trading is seldom used on small and micro cap stocks or in illiquid bond markets. These systems can be traded on any time frame, from fractions of a second up to weekly or monthly time frames.

How algo trading works

Analyzing Charts
Image Source: REDPIXEL.PL / Shutterstock.com

An algo trading system requires a live price feed from a stock exchange, and the necessary infrastructure to submit orders to the exchange. Software that can read the incoming price feed, run a trading program and submit orders is also required, as well as the necessary hardware to run the software. In some cases, additional feeds may also be required for fundamental or market sentiment data.

Finally, a rules-based trading strategy needs to be coded to run on the software. The algorithm will then monitor the market to see when all required conditions are met. Orders are then automatically generated and submitted to the exchange. As soon as a trade is executed a message is sent back to the platform to update position and order management tools.

Automated trading algorithms must also manage live trades to manage risk and exit the trade when targets are reached or stop loss levels are breached. An important aspect of any trading system is its ability to ensure that exposure is managed and obsolete orders in the market are deleted.

Who uses algo trading systems?

Trading Room / Stock Quotes
Image Source: ViblyPhoto / Shutterstock.com

Algorithmic trading is often associated with HFT, or high frequency trading. HFT is indeed based on lightning fast algorithms that exploit price differences between exchanges. However, the use of computer programs is far more widely used in the financial markets. Algo trading is making its way into almost every part of the trading and investment industry. In addition, new approaches to trading and money management that are only possible due to newer technologies are emerging.

The first automated trading systems were created by trend following funds. These funds use a mechanical approach based only on price and end of day data. This meant that some of the earliest mainframe computers could be used to generate trade signals. Since then algo trading has come a long way. For many funds the entire investment process is being automated, from research, to stock selection, executions and risk management.

Quantitative investing funds make extensive use of technology to find relationships between securities and to optimize strategies. These funds combine computing power with statistical and mathematical models to maximise risk adjusted returns and then identify and execute trades quickly.

Hedge Fund Manager
Image Source: Matej Kastelic / Shutterstock.com

Hedge funds are increasingly reliant on automated trading to ensure rapid execution of large numbers of trades. Funds like Catana Capital’s Data Intelligence Fund also use technology to find and use new sources of data. The Data Intelligence Fund uses data from news and social media platforms in the form of real time sentiment scores, adding another source of market intelligence to the investment process.

Banks and institutional brokers use stock trading algorithms to execute large orders with minimum market impact. Market makers also use algos to optimize their pricing so as to manage risk while still generating profits. And, option traders use algorithms to dynamically hedge positions and manage risk as prices move.

Professional traders and day traders are also beginning to use algo trading more widely. Automated trading platforms and algorithmic trading software are now widely available to retail traders and investors. Platforms like MetaTrader and NinjaTrader allow individuals with very little programming knowledge to easily set up automated systems. These are particularly popular in the forex market as they can be set to run 24-hours a day.

Stockbrokers like Interactive Brokers make trading platforms capable of running advanced trading algorithms available to a growing number of algorithmic stock traders. These platforms give traders access to markets around the world and provide margin trading and stock borrow facilities and even access to capital.

Examples of algorithmic trading strategies

Trading Graph / Chart
Image Source: Sittipong Phokawattana / Shutterstock.com

As mentioned, a very basic algorithmic trading system can be based on just one or two very basic indicators. At the other end of the spectrum, the most innovative funds use information from company financial statements, artificial intelligence and big data to identify and opportunities that can give them an edge. The following are examples of algorithmic trading strategies, starting with the simplest, and progressing to more complex systems. The common theme amongst the strategies is that they can all be converted into an algorithm based on a set of rules:

Trend following strategies buy strength and sell weakness to ensure that the fund always has a position in the prevailing trend. These systems use moving averages or trend channels based on historical highs and lows. The objective is to capture long term trends, while minimizing losses during periods of consolidation.

Mean reversion strategies attempt to profit from the fact that prices tend to revert to their average. This is particularly true during periods where prices are rangebound. They are usually based on oscillators or volatility bands and moving averages. Increasingly these types of systems use market sentiment to identify extremes.

Arbitrage trading strategies simultaneously open long and short positions to profit from temporary mispricing. Arbitrage strategies can be used when the same security trades on different exchanges at different prices. It can also be used with related securities like different classes of shares or involve convertible bonds. Sometimes, when a company is listed in different countries, an arbitrage trade will involve a currency trade as well. Automated trading is particularly well suited to arbitrage as complex calculations can be done to exploit opportunities that may only exist momentarily.

Trader Analyzing Data
Image Source: REDPIXEL.PL / Shutterstock.com

Statistical arbitrage combines price data and fundamental data to open long and short positions in similar stocks. For example, an algorithm might open a long position in BP and a short position in Shell based on their relative valuations. Such a trade would have little exposure to the market or the oil price but be a bet on their relative valuations changing.

Index arbitrage profits from mispricing between equity and futures markets. When an index futures contract, and the index it is based on, move too far apart, traders can lock in risk free profits by opening long and short positions in the underlying stocks and the futures contract. The stock trades are executed using an algorithm that simultaneously buys or sells all the stocks that make up the index.

VWAP and TWAP algorithms are used by institutions to execute large orders. An algorithm can be used to automatically buy a certain number of shares at the VWAP (volume weighted average price) for the day. The algorithm will automatically buy shares throughout the day to keep the average price in line with the market’s average price. TWAP (time weighted average price) is similar but uses the market price at regular intervals to calculate the average price. These algorithms can also be set to trade a certain percentage of the total market volume. These algos are used to limit the market impact of large orders.

Asset Management / Quantitative Investing
Image Source: PopTika / Shutterstock.com

Quantitative investing strategies use a combination of factors such as value, growth, dividend yield or momentum to select securities to buy or sell. While these strategies are not always automated, increasing numbers of quant funds are automating execution.

Quant trading strategies can be based on any combination of price and fundamental data. Rotational strategies use a ranking table to constantly rotate capital into the top ranked stocks and out of lower ranked stocks.

Index changes also provide opportunities for algo traders. Indices are rebalanced at regular intervals meaning index funds like ETFs need to rebalance their holdings. Algos can be used to calculate the likely orders that will arise and profit from expected changes in supply and demand.

Advantages of algo trading

Advantages Algo Trading
Image Source: kkssr / Shutterstock.com
  • Algo trading systems are usually based on empirical evidence about the observed behaviour of stocks. This differs from discretionary trading which is very often based on theories and forecasts. Because algorithms need specific rules, they are easy to back test. By contrast, forecasts and discretionary decision making are difficult to test until after the fact.
  • Algorithmic and quantitative trading systems are able to cover a very large universe of securities. Humans can only research and monitor a limited number of markets, while a standard desktop computer can monitor thousands of securities. This expands the opportunity set for an automated trading system and reduces costs.
  • An automated trading system can identify opportunities that meet the strategy’s conditions and execute trades much faster than a human trader. Opportunities that only exist for a fraction of a second can be exploited and there is less chance of a trade being missed.
  • Algo trading systems are not prone to human error. This applies to research, identifying opportunities, calculating the correct trade size and executing trades.

Disadvantages of algo trading

Disadvantages Algo Trading
Image Source: FGC / Shutterstock.com

While there are significant advantages to algo trading, it is not without certain drawbacks and risks.

  • Systematic trading strategies don’t always continue to perform indefinitely. As other traders build systems that exploit similar patterns or inefficiencies in the market, a system’s edge may be eroded. For trading strategies with small margins, transaction costs can quickly outweigh profits.
  • Algo trading systems are not able to adapt to changing market conditions like human traders can. A particular challenge for trading systems is knowing when to turn them off, or when they may no longer be viable at all. Losing streaks are often followed by winning streaks and there is always a risk of turning a system off just before a winning streak begins. On the other hand, if a system is no longer viable, it will only continue to generate losses.
  • Large spikes in volatility and flash crashes are another challenge for system traders. When volatility rises, the risk of slippage and large overnight gaps increases. If leverage is being used, this can be fatal for a trading system. At the same time volatility often creates the best opportunities. Furthermore, automated systems cannot determine when an increase in volatility is likely to have been caused by human or system errors, or by more permanent factors.
  • Increased volatility can also cause the correlations on which some systems are based to break down. This applies particularly to statistical arbitrage and similar long / short strategies.

Conclusion

Algo trading is rapidly becoming standard for short term traders and longer-term fund managers alike. As mentioned, there are risks and drawbacks. However, as markets become more efficient, opportunities are smaller and traditional approaches to markets are becoming less viable.  Algorithmic trading systems can monitor more securities and remain viable by exploiting smaller but more numerous opportunities.

Like most industries, continued automation is now a feature of financial markets. New technologies like machine learning and big data are also leading to new approaches to trading, most of which are best suited to automated trading. It is therefore likely that algorithmic trading is likely to dominate the market even more in the future.

About Richard Bowman
Richard Bowman is a writer at Catana Capital, analyst and investor based in Cape Town, South Africa. He has over 18 years’ experience in asset management, stockbroking, financial media and systematic trading. Richard combines fundamental, quantitative and technical analysis with a dash of common sense.

Be the first to comment

Leave a Reply

Your email address will not be published.


*