Algorithmic trading is fascinating because it works faster than any human ever could. This is possible because computers employ algorithms to perform decision-making functions that we as humans cannot. 

It is not because algorithms are smarter than humans, they are after all human-made. Not only can algorithms process facts faster, but they are also not distracted by the stuff that makes us human; like emotions, hunger, fatigue. 

How common is algorithmic trading?

Currently, algorithmic trading accounts for about 65% of trading in the United States. The primary function of an algorithmic trading program is that they can search for all digital information that will affect the markets it is watching. With information aggregated from the digital world, a program is built. The program is then is tested against real markets and other algorithms. 

Algorithmic trading simply looks for statistical correlations and divergences that mean that market values are moving. These data points are collected and used to develop a trading algorithm. A ‘moving average’ is derived from this collected information. 

This average is typically derived from between 50 to 200 days of the asset’s value; that is why it is a moving average. So when the value of an asset drops below the moving average the algorithm buys as much of the asset as is can. 

On the whole, these machines are able to make better trading decisions than a human. There are naturally, limitations to algorithmic trading.

These algorithms and the machines that run them are, not surprisingly, very expensive to own, use and maintain. So, those who are able to employ them are large institutional traders such as insurance companies and pension funds. 

This is beginning to change slightly as personal trading bots are becoming more popular and more successful. The main difference that remains for personal and institutional trading is that there will be a significant divergence of the scale of purchases for an individual investor and a pension fund.  

A Closer Look at Algorithms

As I mentioned, one of the drawbacks of algorithmic trading is that it relies on high-frequency-trading. This is potentially problematic because, at this point, any successful trading institution is employing HFT. And to be competitive in algorithmic trading relies not just on good algorithms, but more importantly on the speed of execution. If your machine is a millisecond (literally!) too slow, it will miss the deal. 

There are also many who think that HFT trading that relies on such fast-moving algorithms are unethical. This is because they have an unfair advantage over smaller traders. As such those who do not have the resources and capacity to compete will not be as successful. 

However, there are many who believe that HFT is beneficial to the individual investor because it creates liquidity and opportunities to profit from the knowledge of successful algorithms.

As I mentioned, another issue is that machines are not smarter than humans. However, they sure are much faster. So, machines can process quickly the dollar value of moving the market. 

However, it is not always the best decision for the humans that rely on algorithms to maintain the market’s stability. That is if the name of the game is to make money, then buying low and selling high is in order. 

But what if it is for something essential, like natural gas for heating people’s homes. It is in the interest of the algorithm to get the best price, but that might mean that individuals are now paying twice what they were yesterday to heat their homes. This will mean than many in the world will not be able to afford their bills, and so they will just freeze. 

Overview of Algorithmic Trading

So, successful algorithmic trading is a fine balance between human needs and machine learning. This is perhaps the whole point, however. Humans rely on machines, and machines have improved our lives in a myriad of ways. But we need to be in charge of the algorithms and to continue to test them in order to ensure that they are working for us, and not just for the sake of the algorithm.

Algorithmic trading is a work in progress. And as such, there is a lot that goes on under the hood when we are looking at the mechanics of algorithmic trading. 

So let’s get to it. The rest of this article will breakdown many of the main features and strategies behind algorithmic trading.

  • The Benefits of Algorithmic Trading
  • Who Uses Algorithmic Trading
  • Moving Average 
  • Technical Requirements for Algorithmic Trading
  • Algorithmic Trading Strategies
    • Trend-following StrategiesArbitrage OpportunitiesIndex Fund RebalancingMathematical Model-based StrategiesTrading Range (Mean Reversion)Volume-weighted Average Price (VWAP)Time Weighted Average Price (TWAP)Percentage of Volume (POV)Implementation Shortfall

The Benefits of Algorithmic Trading

Algorithmic trading has the following benefits:

  • Smart algorithms allow trades to be executed at the best possible price.
  • Trades are executed accurately and quickly; 24/7. This means that there is less chance of losing a deal because a trader is not fast enough.
  • Trades can be executed once the desired price is met. There is much less room for a bid-ask spread.
  • Machines reduce transaction costs because an investor does not rely on a broker.
  • Machines can be programmed to simultaneously and automatically check on multiple markets.
  • Fewer errors are made than there are when the order is a manual, human order. 
  • Backtesting is necessary so that an algorithm is tested against itself as well as historical data. This testing increases the accuracy of the moving average and predicted future value.
  • Decisions are based on algorithms that work under the instructions of the code, so there is less risk of human emotions affecting decision making.

Who uses Algorithmic Trading?

Algorithmic trading is used for all kinds of trading; including short and long term investing. It is primarily large pension funds and insurance companies that buy stocks with algorithmic trading and high-frequency trading. This is because these algorithms and programs are presently unavoidably expensive to maintain.

But not only will large institutions benefit from algo-trading. Because algo-trading adds liquidity to the market, so short-term traders such as brokerages and arbitrageurs can benefit from these larger trades. Trend followers, hedge funds and pairs traders also use algo-trading. Algorithms make trading much more efficient as the programs run automatically.

The Benefits of Algorithms

Algorithmic follows a specific set of instructions, it is a simple binary code. The instructions include relevant details, such as timing, price, and quantity. They then use relevant mathematical models to organize and coordinate the application of the acquired data. 

Algorithmic trading uses computer programs to place trades that have gathered a significant amount of relevant information. This is because the machine can search all digital information relevant to the trade.

One real improvement of algo-trading is that it can operate at a speed that is not possible for a human trader. But algorithmic trading also adds liquidity to the market simply because it increases activity in the market. 

Moreover, by using specific programs, trading arguably is much more systematic and far less affected by human emotions. That is, machines make decisions based on data, not on fear. 

However, there is an important “Black Swan” phenomenon to consider. Even though algo-trading is much less susceptible to human error of judgment, there are multiple and somewhat regular market dips, or black swans, with algo-trading.  

We are not certain why it happens at this point. But it’s as though the machines see an opportunity to move stocks and so they do. These can cause very a significant dips and floods on the market. However, within a matter of minutes, the market will return to its stasis. So there is a sudden dramatic move in the market, before it returns to normalcy shortly afterward.

Moving Average 

One of the most important pieces of data for any algorithm is the “moving average.” A moving average is the average price of a stock. This average is derived from a collection of past data points. It is an important value because it suggests the real value of the asset, as stock prices fluctuate in price constantly. 

Moving average also lets us know when a stock has moved below or above its real value. This is useful to know when is the best time to sell or buy. 

For example: it is best to buy 25 shares of a stock when its 50-day moving average is over the 200 moving average. And so it is best to sell shares of a stock when it is below its 200 day moving average.

The moving average is just a way to study the past value of shares. It does not mean that the shares will remain at that value. That is going to depend on the market as a whole. However, what it does is set the bar for what the stock should be valued at. 

So, the simplest application is that once it moves below that average it is a good time to buy, and when it moves above it is a good time to sell. Of course, it is not as simple as that. But it is the basic idea. 

Technical Requirements

In order to be successful in algorithmic trading, investors need:

  • Extensive computer-programming knowledge to program the required trading strategy. This means that programmers understand the way that both the markets and the algorithms behave. The software is then designed to support the needs of the investors.
  • To be successful, algorithms need access to market data feeds so that they can monitor the information. Algorithms should look for converging and diverging patterns in the market, as well as take world events into consideration. 
  • A significant amount of capital is needed in order to be successful on a competitive scale. While it is potentially possible to make smaller gains from HFT or bot trading, a single investor may not be as successful as large investment funds. This is for the simple fact that maintaining successful and competitive algorithms is expensive. 
  • Successful backtesting of algorithms that relies on historical data of the markets. This data is used to create and run the initial program. The algorithms are designed to function within parameters of the market’s historical behavior. 

Tools for Personal Algo-Trading

If you are interested in personal algo-trading then check out Rao Vinnakota’s post on personal tools for algorithmic trading. Here is a selection of the platforms and tools available currently. The following are straightforward services to help get you started with your own algorithmic trading. 

  1. Quantopian
  2. QuantConnect
  3. QuantRocket
  4. Zipline/Zipline-Live
  5. BackTrader
  6. IBPy
  7. Pyfolio
  8. Alphalens
  9. TradingView
  10. InteractiveBrokers
  11. Alpaca

Be sure to have a look at How To Code a Trading Bot and Best Crypto Trading Bots for additional information.

What Do the Algorithms Look For?

If these programs are doing all the work for you, what exactly are they doing? What information do they have access to that human traders do not?

Again, it is not that these programs do inhuman things, they are made by humans. But they can process a much larger volume of information and therefore can reach better-founded conclusions about the market’s movements. 

The following was cribbed from Investopedia. Check out their full article if you’re interested. 

A good algorithm will perform the following:

  • Read the incoming price feed of Royal Dutch Stock [as an example] from both exchanges.
  • Use the available foreign exchange rates and convert the price of one currency to the other.
  • If there is a large enough price discrepancy found from on exchange to another, then there may be an opportunity to profit. Then the program should place the buy order on the lower-priced exchange and sell the order on the higher-priced exchange. The price difference will lead to an arbitrage profit.
  • The more complex an algorithm, the more stringent backtesting is required before it will function correctly.

This is a race to the finish line! If one investor can place an algorithmic trade, so can others. That means that prices fluctuate in milli- or microseconds. 

Strategies

Trend-following Strategies

A 50- and 200-day moving averages are a popular trend-following strategy. This is because it is a simple way to follow trends in moving averages. These do not rely on predictions, but simply watch for the moving average to change to determine when is the best time to buy or sell.

Trends-following aims to take advantage of long, medium and short term movement in the market. This is not often considered a “predictive” strategy because it does not try to predict a new trend, it simply bets on the maintenance of a current trend. 

This is referred to as the “bandwagon effect” as investors simply follow the direction of the market, rather than attempt to understand or uncover new trends. It simply follows the success of the current market trend. 

Arbitrage Opportunities

Arbitrage is when an investor buys a stock in a lower price market and then sells it on another market with a higher value. An investor can employ arbitrage by buying a stock on a foreign exchange where the price hasn’t yet increased to another market’s rate. This occurs with Bitcoin, as it is more valuable in places with unstable governments, such as North Korea and Venezuela

This strategy is basically a risk-free investment because the asset is instantly sold at a profit. Using an algorithm, price differentials are identified, the asset is then bought and sold to benefit from the price differential.

Index Fund Rebalancing & Algos

Rebalancing is a periodic sale and purchase of assets in a portfolio which is meant to maintain a specific level of risk. This has to do both the asset classes of the investor, such as the asset allocation of stocks to bonds. 

When rebalancing takes place, there is an opportunity for algo-traders to capitalize on these exchanges that offer 20 to 80 basis points profits. The timely execution of these orders is essential, and therefore an excellent use of algo-trading.

Mathematical Model-based Strategies

The typical trading strategy is referred to as the “delta-neutral trading strategy.” This is a proven mathematical model that allows trading for many options and the underlying security. 

The idea is to use a strategy that has multiple positions that will offset positive and negative deltas. This is the ratio that compares the change, or market price, of the price of an asset, to the corresponding change in the price of its derivative. This is done so that the overall delta of the assets in question totals zero.

Trading Range or Mean Reversion

Algorithms are used to make purchases when an asset’s price moves out of its defined range. This defined range is the “trading range.” It is also a “mean revision” because it acts on the temporary price of an asset. 

That means that the algorithms are looking for real averages and aims to exclude the outliers. For instance, if one of your assets is down 25% this month, then it not likely fall as far next month. Good algorithms look for those black swans and use them to come to better conclusions. 

Volume-weighted Average Price (VWAP)

Volume and price determine the average price of a security traded throughout the day. This is the volume-weighted average. It is useful because it offers insight into the trend and value of a security.

The volume-weighted average price is a measure of the average price that a stock is traded over a specific time period. It is the ratio of the value traded to the volume. Passive investors will use the VWAP as a benchmark, which can include mutual funds and pensions. 

Trades are executed so that they are in line with the volume of the market. This is meant to minimize market impact. This is because if large amounts of a stock are moved, the whole asset may be affected. 

Time Weighted Average Price (TWAP)

TWAP refers to the time-weighted average price of a security over a specified time. The goal of this strategy is to move discrete chunks of an asset at specific time intervals. This is so that the movement does not affect the market, causing the price of an asset to drop or rise dramatically. 

The idea is to maintain the average price with the order is being executed. That means moving large amounts of an asset without disrupting the market and losing profits. If a large amount of shares is dumped into the market it would have an adverse effect on it. This is because traders will be alerted to a major change. Then, traders and algorithms alike might interpret something negative about the movement. 

By remaining close to the average with smaller parcels, the price of the stock is not dramatically affected. And as algo-trading is often working with HFT it is an important consideration.

Percentage of Volume (POV)

A POV is a percentage of the volume of a specific stock that is being traded. It means that the stock is not being sold all at once. Instead, it is sold in carefully at timed intervals. The algorithm is designed to send partial orders until the entire order is filled. This occurs within a certain time-frame, and at a desired price.

Moving a stock in percentages is beneficial because it keeps the market price steady. Doing so allows the order to be executed very close to the market price. But the sale is made with smaller moves that do not impact the market as seriously as larger ones will.

Implementation Shortfall

Many strategies are aimed at minimizing losses, just as implementation shortfall is. This strategy works by trading off the real-time market. Doing so decreases the delay of execution, and therefore the potential change or slippage of the price. 

Implementation Shortfall will increase the targeted participation rate when the stock price moves in the right direction for the buyer. Therefore it decreases when the stock price moves adversely.

Backtesting

Backtesting is central to the success of algorithmic trading and trading bots. In order to be sure that the algorithms work, backtesting is a requisite. 

It is called backtesting because it uses historical data to test algorithms that work for future trades. The idea being, that if the algorithm is successful with historical data, then there should be a similar future outcome. This is done in a safe experimental environment where no real profits are lost. 

This testing should also reveal the level of risk involved with the investment, as well as demonstrate the general profitability. If the outcomes are not positive, then the investor should rewrite the algorithm.

Algorithmic trading relies heavily on backtesting because all algorithmic program needs to start with an initial plan or code.  

Wrap Up

Who is using algorithmic trading?

Mostly large institutional investors, however, within the last decade personal algorithms and bot trading have increased. 

What are the challenges facing algorithmic trading?

To be really successful as an algo-trader, you must run and operate powerful and costly computers. And programming trading bots requires savvy, research and constant backtesting. 

Why is algorithmic trading successful?

Accuracy and speed are the most advantageous qualities of the machines. Humans cannot work as quickly, accurately, or as consistently as a computer can.

trade predictions