Understanding algorithmic trading

Algorithmic trading is an investment strategy that often resembles a 100-meter dash more than The Fool's usual approach of steady long-term ownership of top-shelf quality companies. But even though you might not plan on lacing up for an algorithmic trading sprint, understanding it is key in the modern world of investing. After all, large portions of today's stock market rely directly on this tool.

A robot's hand pressing a key on laptop that has rising stock charts on its screen.
Image source: Getty Images

The ABCs of algorithmic trading

The ABCs of algorithmic trading

Algorithmic trading, also known as algo trading, occurs when computer algorithms -- not humans -- execute trades based on pre-determined rules. Think of it as a team of automated trading systems that never sleep, endlessly analyzing market trends and making trades in the blink of an eye.

The algorithms can be trained to manage all sorts of trading. Quick trading and highly liquid markets can make this tool more effective, so it is more commonly seen in fast-moving markets such as stocks, foreign exchange, cryptocurrencies, and derivatives. Low or nonexistent transaction fees make it easier to turn a profit with rapid, automatically executed trades, so the algorithms are typically aimed at low-cost opportunities. However, a tweak here and there can adapt the same trading algorithms to slower-moving markets such as bonds or real estate contracts, too (Those quick-thinking computers get around).

Over time, these systems have grown increasingly sophisticated, utilizing artificial intelligence (AI) techniques like machine learning and deep learning. Some even use large language models (LLMs) similar to OpenAI's ChatGPT, analyzing financial news and social media chatter to make trading decisions. Taking advantage of a more detailed set of real-world variables can make the algorithm more effective, at least in theory.

Artificial Intelligence

Artificial intelligence is the use of machines to mimic human intelligence.

Most algorithms employ some sort of quantitative analysis, executing trades when the asset's trading follows a certain pattern. It's useful to give the computer access to some very deep pockets, to the point where its automatically executed trades can control the real-time price action to some degree. Even without that price-moving advantage, the millisecond reaction time of a computerized trader can turn a profit even from a relatively quiet market with little price movement.

The relevance for buy-and-hold investors

The relevance for buy-and-hold investors

As buy-and-hold investors, we might wonder why we need to understand the lightning-fast world of algorithmic trading. Successful long-term investing is better served by patience, foresight, and staying the course, right?

Well, even from a view on the sidelines, you should know how algorithmic trading influences the markets. These algorithms can affect stock prices and market volatility, creating ripples that eventually touch our portfolios.

However, it's important to remember that these trading algorithms are designed for the financial equivalent of bullet chess, with one hand on the clock and where fractions of a second mark the difference between winners and losers. That's not the slow and steady investing game we humans are used to, and not necessarily one we should attempt to emulate.

Proceed with caution

Proceed with caution, dear investor

Should you be tempted to dip your toes into the world of algo trading? As a seasoned long-term investor, I would advise caution. Algo trading, especially the kind driven by advanced AI, is a complex field that requires a unique set of skills in programming, data analysis, and finance.

The fast pace of algo trading could lead to quick gains -- but remember that rapid losses can pile up just as swiftly, especially in volatile market conditions. For us, it might be like trying to sprint in a marathon. You're looking at exhaustion and potential injury (financially speaking) more quickly than sticking with a slow and steady pace.

You and I are not computerized hares, moving more like the inexorable tortoise of Aesop's classic fable. And there is nothing wrong with that since a more methodical approach suits human investors better. Warren Buffett made his billions without leaning on digital high-speed trades. Algorithmic trading funds like Citadel and Renaissance Technologies may have made multibillionaires out of Jim Simons and Ken Griffin, but even they can't hold a candle to Buffett's more methodical wealth-building acumen.

An inside look at algorithmic trading

An inside look at algorithmic trading

To understand how a quantitative stock fund uses algorithmic trading, let's imagine a situation with a fictional stock called the Intergalactic Trading Company, which has the ticker "SPAACE."

Our quant fund has developed a complex model trained on vast amounts of historical market data. This model predicts, with a certain degree of probability, that when the trading volume of SPAACE shares traded crosses a certain threshold with positive price momentum, the price is likely to rise significantly in the next few minutes before it corrects back down. That's how the stock has behaved many times in the past, and it looks likely to do it again, and again, and again -- maybe many times in a single day or even in a five-minute span. SPAACE is a volatile little ticker!

One fine Monday morning, as the opening bell rings on Wall Street, the fund's trading algorithm, affectionately called "QuantBot," springs into action. It monitors the trading volume of SPAACE, never taking its digital eye off the proverbial ball. At 10:03 AM, QuantBot notices that the trading volume of SPAACE starts to spike.

QuantBot quickly cross-checks the other criteria outlined in its model. The share price is moving upward, and a quick AI-powered sentiment analysis of social media posts about SPAACE shows increasing investor enthusiasm. All the stars align, and the algorithm decides to make its move. In fact, it doesn't have a choice -- this is exactly what the program was looking for!

Related investing topics

Faster than a blink, QuantBot purchases a substantial number of SPAACE shares. In this brief window, thanks to the uptick in volume on top of already-positive market sentiment, the share price starts climbing. Remember, this is all happening within a matter of minutes or seconds, or maybe fractions of a second in some cases.

At 10:07 AM, QuantBot notes that the price momentum is slowing down and starting to stabilize. Following its pre-defined rules, it swiftly sells off the SPAACE shares it just bought, locking in a tidy profit.

In this scenario, our QuantBot pal has made a profitable trade by identifying a quick market trend using data and algorithmic precision. It took advantage of the price surge it helped create, bailing out before the artificial price trend turned back down. This is one of the many ways a quantitative fund can aim to make money using algorithmic trades. Note -- the Intergalactic Trading Company's business results have almost nothing to do with this process. Algorithmic trading sessions like these play out every day, with or without real-world news to inspire any market action. As long as there are people (or other algorithms with different trading criteria) ready to buy what your bot is selling and sell what it's buying, the show can go on.

It sounds easy when you lay it out like this, but many of the ideas involved run counter to the ideas of fair markets and investor transparency that we hold dear at The Fool. The algorithm is not a magic wand. There are many variables and risks involved, and you need high-powered computers plus plenty of investable funds to implement this kind of trading strategy effectively. Even the most sophisticated trading algorithms often lose money on individual trades. You gotta know when to hold 'em, know when to fold 'em, etc.

This is not a game for the typical individual investor but a specialized arena for the algorithmically adept and financially fortified. The rest of us are better off following the patient long-term investing tenets of Warren Buffett and Benjamin Graham.

The Motley Fool has a disclosure policy.