# What Algorithms Can Be Used for Trading: Basic Classification

Users of the Quora resource wondered what kind of online trading algorithms there are. The best answer was given by trading robot developer Jae Yang. We present to your attention a description of its classification.

According to Yang, there are 4 main types of trading algorithms:

- order execution algorithms;
- algorithms using behavioral factors;
- scalping algorithms;
- predictive algorithms.

## Review of The Main Exchange Trading Algorithms

### Order Execution Algorithms

Major financial funds constantly redistribute their funds between different assets. To achieve greater trading efficiency, various algorithms are used. The simplest options are TWAP (time-weighted average price) and VWAP (volume-weighted average price). There are also more sophisticated ones, but they perform essentially the same tasks - for example, the Port-X algorithm developed at Goldman Sachs

The general principle of operation of such algorithms is as follows: they assess the state of the stock market over a certain time and rationally place buy or sell orders. It is more profitable for a trader to split an asset into many small blocks so as not to be too dependent on price jumps. Let's say he needs to execute an order on an asset worth $100 million for an average daily trading volume of $1 million. In this case, the investor is too dependent on price action if he does not rationally distribute orders over a sufficiently long period.

Imagine that you need to fill a swimming pool with buckets. You won't be able to do this without splashing water in the process.

At the other end of the spectrum, the fertile realm of high-frequency trading awaits us. Here, algorithms can be divided into two general categories.

### Algorithms of Behavioral Factors

They are based on an analysis of the actions of competitors working with a specific trader in the “same territory.” In the case of assets with low liquidity, most often there is one major player and everyone else. In such conditions, recognizing the behavior of rivals becomes a completely feasible task than in the presence of 10,000 traders of equal strength. To build a system that can benefit from the actions of opponents, it is enough to understand what rules they follow and in what cases they deviate from them.

### Scalping Algorithms

High-frequency trading (HFT) firms are constantly competing to see who is the fastest gun in the Wild West. Excellent opportunities for price arbitrage arise at the level of market microstructure.

At the macro level, such fluctuations occur constantly. To initiate and carry out a transaction, someone is needed to offer the same or more amount than the requested amount. Often, this happens when in reality there is a bid for $10.0001 and an ask for $10. This is where speed comes into play. The fastest computers can catch this difference of $0.0001. The system opens a position for $10 and sells it to someone else for $10,001. Scalping algorithms must be fast and efficient. Most often, they are developed, tested, and deployed on ASIC or FPGA circuits

### Predictive Algorithms

In most cases, when someone talks about trading algorithms, they mean this particular type. Forecasting algorithms include all options for predicting market behavior based on analysis of past information, new data, and any secondary information. They can be divided into several subcategories, according to the methods used:

- reversion to the mean value;
- following the trend;
- price curve patterns;
- fundamental analysis;
- portfolio balancing.

#### Reversion to the Mean Value

Reversion to the mean value is based on the idea that there is some “fair” price to which the market returns. Algorithms using this technique attempt to create normalized price patterns based on analogs, certain reference points, or previous values. Trading currency pairs is the simplest example. The correlation of values is calculated for two markets to understand in which case one currency can be used to buy another. When to go short and close if the pair trades in tandem again. For the system to work, curve pattern algorithms are then applied.

#### Following The Trend

Trend-following algorithms are designed to detect the presence of long-term trends for specific asset classes. The effectiveness of such algorithms depends on whether the system can determine who is currently opening positions. The stock market is an example of a large collective hunt, where each player pursues his own goal. Therefore, it is difficult to discern any patterns in price movements. However, some people are confident that secondary information on the movement of money supply from one asset to another, with correct diagnosis of the entire network, gives results. That is, simply put, the price value is influenced by many additional factors, and not just the balance of supply and demand.

Algorithms that rely on **curve pattern analysis** follow the age-old belief that “pictures and graphs don’t lie.” It is also sometimes called technical analysis. It deals with a set of patterns that describe the behavior of a curve. For example: “double top”, “head and shoulders”, etc.

*Head and shoulders technical analysis figure*

Despite the somewhat old-fashioned belief in the power of charts and graphs, serious articles continue to appear on the topic of how to make money by studying patterns of price behavior. Here is an example of such a study.

#### Fundamental Analysis

Fundamental analysis deals with company reporting data and government statistics to determine when a particular market is overvalued or undervalued compared to similar ones. Large companies have a staff of analysts that allows them to do this much more effectively than private investors. The latter, for example, simply do not have time to calculate such things as, conditionally, how many pairs of jeans the largest American retailer Gap sold. These same systems can also use macroeconomic data to determine global cycles.

#### Portfolio Balancing

Balancing an investment portfolio is based on two different ideas about the behavior of the stock market. There is a type of algorithm called Smart Beta. It works on the “free cheese” principle, where the “cheese” is a portfolio of low-volatility assets. There is also a type of online algorithms, the essence of which is to analyze the cash flow index and apply the mean reversion rule.

# Conclusion

Of course, this classification is incomplete and does not include, for example, algorithms for analyzing public opinion (in social networks or using services like Google Trends), studying news or analyst forecasts, as well as machine learning algorithms (in supervised and unsupervised format ). However, it allows novice traders to get a basic idea of the variety of existing algorithms for working on the stock exchange.