What Is an Algorithm?
An algorithm is a set of instructions for solving a problem or accomplishing a task. One common example of an algorithm is a recipe, which consists of specific instructions for preparing a dish or meal. Every computerized device uses algorithms to perform its functions.
- An algorithm is a set of instructions for solving a problem or accomplishing a task.
- Every computerized device uses algorithms to perform its functions.
- Algo trading, also known as automated trading or black-box trading, uses a computer program to buy or sell securities at a pace not possible for humans.
- Computer algorithms make life easier by trimming the time it takes to manually do things.
- Algorithms allow workers to be more proficient and focused, making slow processes more proficient.
How an Algorithm Works
Financial companies use algorithms in areas such as loan pricing, stock trading, asset-liability management, and many automated functions. For example, algorithmic trading, known as algo trading, is used for deciding the timing, pricing, and quantity of stock orders. Algo trading, also known as automated trading or black-box trading, uses a computer program to buy or sell securities at a pace not possible for humans.
Since prices of stocks, bonds, and commodities appear in various formats online and in trading data, the process by which an algorithm digests scores of financial data becomes easy. The user of the program simply sets the parameters and gets the desired output when securities meet the trader's criteria.
Computer algorithms make life easier by trimming the time it takes to manually do things. In the world of automation, algorithms allow workers to be more proficient and focused. Algorithms make slow processes more proficient. In many cases, especially in automation, algos can save companies money.
60% to 73%
Of all trading of U.S. equities is algorithmic trading.
A large part of stock trading in the U.S. is done via algorithms. However, algos are likely responsible for even more trading in the forex markets. A big part of that is high-frequency trading (HFT), often employed by hedge funds.
HFT involves using sophisticated computers and algorithms for trading. One side effect of algos is that the average holding period for stocks has decreased significantly—from four years in the 1940s to less than a minute a decade ago.
Types of Algos
Several types of trading algorithms help investors decide whether to buy or sell. The key types of algos are based on the strategies they employ. For example, a mean reversion algorithm examines short-term prices over the long-term average price, and if a stock goes much higher than the average, a trader may sell it for a quick profit. Other algorithm strategies may market timing, index fund rebalancing, or arbitrage. There are also other strategies, such as fund rebalancing and scalping.
Arbitrage looks to take advantage of the price difference between the same asset in different markets. Algos can capitalize on this strategy by quickly analyzing data and identifying pricing differences, then quickly execute the buying or selling of those assets to capitalize on the price difference.
An asset may trade for one price on a certain exchange, but a different price on another—the algo would capitalize by buying the asset at the lower price on one exchange and immediately sell it for the higher price on another exchange.
Market timing strategies use backtesting to simulate hypothetical trades to build a model for trading. These strategies are meant to predict how an asset will perform over time. The alog then trades based on the predicted best time to buy or sell. These strategies involve many datasets and lots of testing.
Mean revision strategies quickly calculate the average stock price of a stock over a time period or the trading range. If the stock price is outside of the average price—based on standard deviation and past indicators—the algo will trade accordingly. For example, if the stock price is below the average stock price, it might be a worthy trade based on the assumption that it will revert to its mean (e.g. rise in price). This type of strategy is popular among algos.
The following is an example of an algorithm for trading. A trader creates instructions within his automated account to sell 100 shares of a stock if the 50-day moving average goes below the 200-day moving average.
Contrarily, the trader could create instructions to buy 100 shares if the 50-day moving average of a stock rises above the 200-day moving average. Sophisticated algorithms consider hundreds of criteria before buying or selling securities. Computers quickly synthesize the automated account's instructions to produce the desired results. Without computers, complex trading would be time-consuming and likely impossible.
Algorithms in Computer Science
In computer science, a programmer must employ five basic parts of an algorithm to create a successful program.
First, they describe the problem in mathematical terms before creating the formulas and processes that create results. Next, the programmer inputs the outcome parameters, and then they execute the program repeatedly to test its accuracy. The conclusion of the algorithm is the result given after the parameters go through the set of instructions in the program.
For financial algorithms, the more complex the program, the more data the software can use to make accurate assessments to buy or sell securities. Programmers test complex algorithms thoroughly to ensure the programs are without errors. Many algorithms can be used for one problem; however, some simplify the process better than others.
Advantages and Disadvantages of Algos Trading
Algorithm trading has the advantages of removing the human element from trading, but it also comes with its disadvantages.
Perhaps the biggest benefit to algorithm trading is that it takes out the human element. With algo trading, the emotional part of trading is neutralized. The potential for overtrading is also reduced with computer trading—or under-trading, where traders may get discouraged quickly if a certain strategy doesn’t yield results right away. Computers can also trade faster than humans, allowing them to adapt to changing markets quicker.
The big issue with algorithmic trading is that it relies on computers. Without power (electricity) or the Internet, algos don’t work. Computer crashes can also hamper algorithmic trading.
As well, while an algo-based strategy may perform well on paper or in simulations, there’s no guarantee it’ll actually work in actual trading. Traders may create a seemingly perfect model that works for past market conditions but fails in the current market.
- Eliminates human elements, emotions
- Creates consistency when testing a strategy
- Over/under trading reduced
- Computers adapt to price and market changes quicker
- Doesn't work without electricity or the Internet
- Can look good on paper but underperform
- Over optimization is possible
- Requires lots of data, computer power, expertise, etc.
What Machine Learning Algos Do Hedge Funds Use?
Hedge funds use a variety of algos and algo-based strategies. This includes using big data sets (such as satellite images and point of sale systems) to analyze potential investments. Algos and machine learning are also being used to optimize office operations at hedge funds, including for reconciliations.
Is Algorithmic Trading Hard?
Actual algorithmic trading on the surface is easy—you implement a strategy and the computer does all the hard work. However, the hard part is putting in enough work to understand the algo, or in building an algo for trading.
Is Algo Trading Safe?
Algo trading is relatively safe, assuming you’ve built a profitable strategy to run. Some algorithms strategies can be purchased, but they still require enough computer power to run.
Do Banks Use Algorithmic Trading?
Banks, including institutional and retail traders, use algorithmic trading. This includes investment banks and hedge funds that use algorithmic trading to perform large trade orders or ensure fast trading.
How Do Predatory Algos Work?
Trading and investing algos can be considered predatory as they may reduce stock liquidity or increase transaction costs. However, directly predatory algos are created to drive markets in a certain direction and allow traders to take advantage of liquidity issues.
The Bottom Line
Algos are used in trading to help reduce the emotional aspect of investing. Algorithms are used by investment banks, hedge funds, and the like; however, some algo-based programs and strategies can be purchased and implemented by retail investors. There are several types of algos based on the strategies they use, such as arbitrage and market timing.