Search

Why you should start algorithmic trading

Updated: Nov 10

Disclaimer:

Please note that the opinions expressed by the author in this article do not constitute financial advice and are solely for educational purposes only. When buying shares, the value of your investment may go down as well as up and you may get back less than you invest.


Algorithmic trading is a tool for traders to use that has incredible potential and has a lower barrier to entry than most people would think. It opens doors to creative techniques that would otherwise be impossible and allows efficiencies that can save a lot of money in the long run. By the time you’ve finished this article, you will know some simple advantages of algorithmic trading and how to get started.


What is algorithmic trading?

An “algorithm” is an umbrella term for receiving data, analysing it, and then taking actions based on a set of predefined rules. Algorithmic trading is the process of using computer programs to execute algorithms, specifically in the context of trading. It is a broad field, so the input data, the rules for analysis, and the actions taken can wildly differ from algorithm to algorithm. It is also often called algo-trading or automated trading, and these terms will be used interchangeably throughout this article.


Here's two examples of algo-trading systems:

  • A system inputs satellite images of the carparks of a large UK based supermarket chain. The system analyses these images and counts the total number of cars that visited the chain’s shops nation-wide this quarter. Before the shop’s quarterly earnings report, the system will purchase stock if it has counted an increase in the number of customers over last quarter.

  • A system inputs the daily close price of a stock and calculates the 50-day moving average and the 200-day moving average. The system then purchases the stock if the 50-day moving average is above the 200-day moving average, otherwise it does not hold the stock.

In both of these examples, a computer can quickly execute each of the three key steps of algorithmic trading, without any human supervision. The program will run everything precisely and accurately around the clock without any psychological, cognitive or emotional biases.


How do I make an algorithm?

Before we explore some improvements automated systems can make over manual traders, let’s discuss why you should be able to make the change in the first place.


As a trader, consistency is one of the most important metrics of success. In order to trade consistently, you must have justification for each of your decisions. If you don’t have a reason to make a decision, or your reasons could contradict one another, you might as well leave the choice to the flip of a coin.


Now, write down how these reasons work as if you were explaining them to a friend. Write them down, no matter how complicated or convoluted, and in as much possible detail for every single step. Ask yourself why you draw every conclusion that contributes to an action. This process can take a long time but it is incredibly important for any trader to be able to do, even if you don’t have any intentions of being an algo-trader.


For example: If you sold an asset because you thought the price might drop below a level of support, think about how and why you drew that support line where it was. Think about why you predicted the price would fall through the support rather than respect it. Think about why you sold when you did, rather than sooner or later.


Now you’ve written everything, congratulations! You have a consistent trading strategy. You have an algorithm. Now you have your algorithm, let’s explore ways that you could improve it with automation, rather than trading it yourself.


Advantages of algorithmic trading

This is in no way a comprehensive list for the tools an algo-trader can use to create an advantage over a manual trader. This article describes only a small number of simple but effective advantages.


Backtesting

Once a strategy is written in code, it is possible to run it in a simulation over historical data in a process called ‘backtesting’.


Backtesting is an immensely powerful tool as it offers near instant access to information about potentially millions of trades, and a strategy’s performance as a whole. It can unearth statistics about strategies such as their risk or drawdown, which could be slow and dangerous to find out without a simulation.


Any trader should aim to backtest their strategies before trading them live as it’s the best way to highlight things that might go wrong. It is a quick process that at worst doesn’t reveal any new information, but at best can save a trader from demolishing their entire trading account.


Here’s an example: if backtesting a strategy reveals it makes an average earnings of $0.10 per trade, but the fees necessary to make each trade added up to $0.15, then it might indicate that the strategy needs to hold its positions for longer or to expand its price targets.


Human traders might try to backtest their strategies manually, however they cannot compete with a computer when it comes to gathering high quality or large amounts of data. A human might not see a one in ten thousand trade that loses 80% of the trader’s capital, or they might be unconsciously biased towards the strategy and exclude the bad trade from the full data report. Even a minor tweak to the strategy will also require a human trader to completely restart their process, whereas an algorithmic trader might only need a few seconds worth of work.


Backtesting can allow a trader to become more bold and creative with their ideas without having to spend much time or money to see results. It requires little effort but can very easily reveal some major red flags in a strategy, consequently saving a trader a lot of money over time. A penny saved is a penny earned.


Scalability

If a strategy can identify profitable circumstances then it would be optimal to search and trade as many of them as possible, but this requires scaling. Algo-trading systems are typically easy to scale, whereas scaling a human operated system may take considerably more effort to maintain.


Consider one of the earlier examples of an algo-trading system, in which a computer counts the number of cars in a carpark from a satellite image, in order to get a rough estimate of a company’s earnings before they are publicly announced. With the same data, it would be possible for a human to be able to count the number of cars too. However, let’s consider that a trader has managed to get more satellite images and would now like to deploy this strategy on a second supermarket chain. For a human, the entire time-intensive work-load has just been doubled. For an already algorithmic trading system, nearly no extra code has to be written. This effect is common among strategies that aim to be deployed across many different instruments or timescales.


If a manual trader has a profitable strategy, they should aim to convert it to an algorithmic strategy in order to capitalize on the benefits of scaling it. If a trader will eventually convert their strategy to an algorithm, why not start with algo-trading and reap the benefits of it through the entire process of developing a strategy?


Never miss an opportunity

Manual traders can often miss out on opportunities simply because they didn’t spot them at the time they were occurring. With an automated trading system, any signals generated by an algorithm are guaranteed to be identified regardless of the time of day. Time that would otherwise be spent putting a strategy to action manually, can instead be used to improve it, while not having to miss out on valuable trades.


Some opportunities such as arbitrage, may only exist for such a slim period of time that it can be incredibly difficult for a human to take advantage of. Some algo-trading strategies are even built with the purpose of exploiting the much slower speeds of manual traders.


A simple example would be a bot that scans news websites for stories on companies, analyses the sentiment, and then purchases a position before a human could finish reading the headline. When human investors hear the good or bad news, they will often make decisions that push the share price in a favourable direction for the bot. If you’re not algo-trading, you’re likely behind the curve on a lot more of your trades than you might imagine, and not just news related ones.


Reduced slippage

When most traders submit orders to a broker, they will likely use “market orders” which will execute at the market price. Depending on an asset’s volume and volatility, the price at which the asset was purchased or sold could drift from the price that the trader saw when they pressed the buy or sell button. The difference between the market price when the order was submitted and when the order was executed is called “slippage”. If a trader predicts an asset’s price will increase, they will likely try to buy it, and if their prediction is correct then slippage will probably be positive. This means most of the trader’s positions will be inefficiently executed.


Algorithmic traders have the advantage of often being able to avoid using market orders if they want to, due to their natural ability to make swift calculations. For example, an automated system based on moving averages will be able to calculate what price the asset would have to reach in order to generate a buy signal. The algorithm can place a “buy-stop-limit order” at the price where a buy signal would be generated, before it is generated, and also define a range of prices at which the algo-trader would find slippage acceptable. This guarantees that the algo-trader will not pay unexpectedly high prices for assets and typically lowers slippage as the order was submitted much sooner.


A manual trader’s ability to use stop-limit orders is hindered as the price range may need to be frequently recalculated and reset, but humans might take too long to do this. Order queues are also first-come-first-served, so algorithms will almost always beat humans to the front of the line, potentially increasing slippage further for the manual traders at the back of the queue.


Where do I start?

Google has created a free browser based IDE called “Colaboratory”. It will let you write code with little to no set-up and run it on their servers, so you could program from any device no matter how powerful.


Most brokerages will have their own API (Application Programming Interface). Put very simply, this is a way that you can send data to a broker in a form that they will be able to understand and process for you. If a broker has an API, you will be able to read lots of information on how to use it by web searching “<Broker’s name> API documentation”.


A personal broker recommendation would be “Alpaca” as they explain everything in a lot of detail and even have some example code you can copy and experiment with. You can even link your Alpaca account to Tradingview to track and analyse your performance in real-time with all the tools you’re already familiar with. Alpaca’s tutorials will explain how to download historical data so you can start backtesting, and also explain how to set-up a live data feed so you can start trading with real-time prices.


In half an hour you could have your very own custom built algo-trading bot running. I highly recommend starting with a free paper trading account and getting straight to learning by doing.


Now you know the benefits of algo-trading and you know how easy it is to start, you have no excuse to not get started!