Trading strategies that are executed based on pre-set rules programmed into a computer
Algorithmic trading strategies involve making trading decisions based on pre-set rules that are programmed into a computer. A trader or investor writes code that executes trades on behalf of the trader or investor when certain conditions are met.
Moving average trading algorithms are very popular and extremely easy to implement. The algorithm buys a security (e.g., stocks) if its current market price is below its average market price over some period and sells a security if its market price is more than its average market price over some period. Here, we consider a 20-day moving average trading algorithm.
The algorithm buys shares in Apple (AAPL) if the current market price is less than the 20-day moving average and sells Apple shares if the current market price is more than the 20-day moving average. The green arrow indicates a point in time when the algorithm would’ve bought shares, and the red arrow indicates a point in time when this algorithm would’ve sold shares.
A large trade can potentially change the market price. Such a trade is known as a distortionary trade because it distorts the market price. In order to avoid such a situation, traders usually open large positions that may move the market in steps.
For example, an investor wanting to buy one million shares in Apple might buy the shares in batches of 1,000 shares. The investor might buy 1,000 shares every five minutes for an hour and then evaluate the impact of the trade on the market price of Apple stocks. If the price remains unchanged, the investor will continue with his purchase. Such a strategy allows the investor to buy Apple shares without increasing the price. However, the strategy comes with two main drawbacks:
A trading algorithm can solve the problem by buying shares and instantly checking if the purchase has had any impact on the market price. It can significantly reduce both the number of transactions needed to complete the trade and also the time taken to complete the trade.
Traders and investors often get swayed by sentiment and emotion and disregard their trading strategies. For example, in the lead-up to the 2008 Global Financial Crisis, financial markets showed signs that a crisis was on the horizon. However, a lot of investors ignored the signs because they were caught up in the “bull market frenzy” of the mid-2000s and didn’t think that a crisis was possible. Algorithms solve the problem by ensuring that all trades adhere to a predetermined set of rules.
A trading algorithm may miss out on trades because the latter doesn’t exhibit any of the signs the algorithm’s been programmed to look for. It can be mitigated to a certain extent by simply increasing the number of indicators the algorithm should look for, but such a list can never be complete.
To keep learning and developing your knowledge of Algorithmic Trading, we highly recommend the additional resources below: