By Chainika Thakar and Varun Pothula

There exist various types of Trading strategies, and as we are aware, trading strategies are an essential part of live trading. When properly researched and executed, a trading strategy helps traders in achieving desired outcomes from executing trade orders.

When the strategy execution is fully automated, this type of trading strategy is called an algorithmic trading strategy. By applying the right trading strategy, a trader can execute trades with more accuracy and confidence. In this article, you will learn the different types of trading strategies and in which

Going further, this article explains:

- What is a trading strategy?
- Components of a trading strategy
- Types of trading strategies
- ML-based trading strategies
- Portfolio of strategies

## What is a trading strategy?

A trading strategy is a detailed plan to analyse the market conditions and make trading decisions. A strategy consists of best practices to estimate the price movements and rules to enter and exit a trade.

## Components of a trading strategy

The following are components of a trading strategy:

- Methods of creating trading strategies
- Trade universe
- Entry and exit logic
- Risk management

**Methods of creating trading strategies**

There are three main methods used to design a trading strategy:

- Technical analysis
- Fundamental analysis
- Quantitative analysis

Adding to the above is:

4. Machine learning for designing the trading strategies

Machine learning is a contemporary practice and is a type of artificial intelligence. Now, let us discuss the introduction of each method:

**Technical analysis**

Technical analysis is a method to identify trading opportunities by studying the trends and patterns in the price charts. Technical analysis assumes that all information related to the stock, such as news, fundamental factors, sentiment, etc., is already included in its current price. So, it focuses on current trends in price, volumes, and estimates the future movements of the price.

**Fundamental analysis**

Fundamental analysis is a method to estimate the intrinsic value of a stock. It is done by studying the industry the stock belongs to, the economy, and the fundamental factors of the company. The intrinsic value is considered to be the true value of a stock. An asset is deemed to be undervalued or overvalued by comparing the intrinsic value to the current price. The undervalued stocks will be bought and the overvalued stocks will be sold.

**Quantitative analysis**

In trading, quantitative analysis is a method of predicting stock prices with the help of mathematical models and statistical techniques. The quantitative analysts assess the price and direction of the stock to find trading opportunities.

**Machine learning for designing the trading strategies**

Machine learning, as the name suggests, is the ability of a machine to learn, even without programming it explicitly. Machine learning is based on algorithms to detect patterns in data and adjust the program’s actions accordingly. Machine learning system detects a trading pattern, learns it, and executes the trade automatically every time.

**Trade Universe**

The trade universe includes products and markets where you apply the trading strategy. There is a wide range of products to trade, such as futures, options, equities. These products facilitate trading in markets like currency, commodities, stocks, cryptocurrency, etc. Every trading product and market comes with its own risks and trade dynamics.

**Entry and exit logic**

Entry and exit logic are a set of conditions that should be met to buy/sell the stock. The entry and exit price levels are defined by the analysis method of the trading strategy.

**Risk Management**

Risk management is a crucial component of a trading strategy. Capital allocation and stop-loss are the main elements of risk management. Capital allocation indicates the amount of capital allocated to each trade. Stop loss is used to limit the risk of the trade. Once a trading strategy is designed, it is backtested to understand its performance.

## Types of trading strategies

Trading strategies can be broadly classified into five types which are:

- Trend trading strategies
- Mean-Reverting strategies
- Breakout trading strategies
- Carry trade strategies
- Event-based trading strategies

## Trend trading strategies

The trend trading strategies generate entry and exit conditions according to the trend of the stock. According to the trending trading strategy, an asset is bought during its uptrend and is shorted during the downtrend, assuming the price to continue in the direction of the trend. And, the trade is exited once the trend reverses.

Using technical analysis, a trend trading strategy is designed based on indicators like moving average crossovers, relative strength index (RSI), and average directional index (ADX).

The following is an example of a trend trading strategy created using technical analysis.

**Strategy Name: Moving Average Crossover**

When the stock is trending up, the moving averages of the price angle up and trends higher along with the price. According to the moving average crossover strategy, a stock will be bought when the shorter period moving average crosses the longer period moving average from below.

To generate short-term trading signals, generally, the 21-day moving average is considered as a shorter period moving average, and the 50-day moving average is considered as a longer-term moving average. For long-term trading, 50-day moving average, 200-day moving average are considered as shorter and longer period moving averages.

In the daily chart of AAPL given below, the long term moving average crossover strategy is used to generate trading signals. On 2nd September 2016, a buy signal was generated when the 50-day moving average crossed above the 200-day moving average. The sell signal was generated on 20th December 2018 when the 50-day moving average crossed below the 200-day moving average.

In quantitative analysis, cross-sectional and time-series momentum strategies come under trend trading strategies.

In cross-sectional momentum strategies, a long-short portfolio is created by studying the relative performance of the securities over a selected period of time.

For example, consider the S&P 500 index. To create a cross-sectional momentum strategy, we will calculate the performance of 500 stocks in the last 3 months. A long-short portfolio is created by taking a long position in the top 20% and a short position is taken in the bottom 20%. The portfolio will be rebalanced every 3 months.

Similarly, to create a time-series momentum strategy, we will create a long-short portfolio by considering the absolute performance of securities over a period of time. A cut-off will be defined and, according to the performance of the securities over a selected period, a long-short portfolio will be created.

For example, for the stocks in the S&P 500 index, a long position is taken in the stocks with more than 5% returns in the last 3 months and a short position is taken in stocks with less than -5% returns in the last 3 months.

In fundamental analysis, factor-based investing is an example of the trend trading approach. Factor-based investing selects the stocks to invest in by considering the factors that explain the stock returns.

These factors include the value, size, volatility, momentum, growth. In addition to these, macroeconomic factors like inflation, interest rates, Gross Domestic Product (GDP) are also considered.

Stocks selected based on these factors are expected to outperform the markets in the long term. The trends of these factors decide whether to buy or sell a stock.

**Mean reverting strategies**

Mean reverting strategies are designed under the assumption that over time, the prices and the economic indicators move back to their mean. The components of a stock such as prices, volatility, etc. are expected to exhibit mean reversion properties.

Buying a stock after a sudden sharp fall below the mean is a basic example of a mean-reverting trading strategy. Several mean reverting trading strategies are designed using technical analysis. Some major examples are:

- Pullbacks and retracements trading strategies
- Oversold and overbought trading strategies
- Range trading systems

Mean reversion trading strategies perform well in range-bound markets.

Let’s consider an example of a most used mean reversion strategy designed using the Bollinger bands.

When the Bollinger bands are non-trending, the upper and lower bands represent the overbought and oversold levels of the price respectively.

- A buy signal is generated when the price trades near the lower band and
- The sell signal is generated when the price trades near the upper band.

Consider the following example of TSLA. As discussed earlier, the mean reversion strategy works best when the market is non-trending i.e. range bound. Flat Bollinger bands represent range bound markets and generate buy, sell signals at oversold and overbought levels.

In quantitative analysis, pairs trading and statistical arbitrage strategies are categorised as mean-reverting trading strategies.

- Statistical arbitrage strategies are created to take advantage of mean reversion characteristics of the price and also the market microstructure anomalies.
- Pairs trading is a market-neutral trading strategy where the long and short positions are taken in the stocks with high positive correlation.

In fundamental analysis, the value investing strategy is a prime example of mean-reverting strategies.

Using fundamental analysis, the intrinsic value of a security is calculated. The security is considered undervalued if it is trading below its intrinsic value. Value investing involves buying securities that are undervalued.

## Breakout trading strategies

Breakout trading strategies involve buying or selling an asset after breaking important price levels such as long-term support and resistance levels of the stock. In technical analysis, buying after a breach of a resistance level or selling after a breach of a support level comes under a breakout trading strategy.

The technical analysis strategies such as opening range strategy, dual thrust strategy and strategies based on breakout of patterns like wedges, flags, head-and-shoulders and triangles come under breakout strategy.

The below is an example of a falling wedge breakout strategy. Falling wedge is a pattern where the price moves between two downward sloping lines that are converging towards each other. A buy position is taken when price moves above the upper line of the wedge pattern.

In the chart below, the security GOOGL has a falling wedge pattern on a daily timeframe in the months of February and March. On April 1, 2021, the breakout of the upper line of the wedge was observed which is a trigger for the buy signal.

In quantitative analysis, advanced quantitative models such as time-series regime switching and hidden Markov models are used to design the breakout strategies.

In fundamental analysis, relative value strategies are considered as breakout strategies. The fundamental ratio of a security is compared with the fundamental ratio of the sector and long/ short position is taken accordingly. For example, the price/earnings ratio (P/E ratio) of Microsoft (MSFT) is compared with the price/earnings ratio of the information security sector.

If the P/E of MSFT is less than it’s sector, then MSFT is considered as undervalued and a long position is taken. Similarly, if P/E of MSFT is greater than that of the sector, then it is considered as overvalued and a short position is taken.

## Carry trade strategies

Carry trade is designed to make profit from the difference between the interest paid and interest earned. This is widely used in the currency market.

In currency markets, the carry trading strategy is executed by selling low-yielding currency and buying high-yielding currency. The carry strategy is executed by buying the currency pair where the base currency has a higher interest rate than the quote currency.

For example, consider the case of a currency pair A/B where currency A has an interest rate of 6% and currency B has an interest rate of 4%. A carry trade is executed by buying the currency pair A/B. This is called a positive carry trade.

Once the trade is executed, you will receive the difference in the interest rate from the broker as long as the difference is positive. However, you would incur losses If the interest difference turns negative, that is, if interest rate of currency B increased and crossed the interest rate of currency A.

In quantitative analysis, market making and cash-future arbitrage are examples of carry trade strategy. In technical analysis, volatility selling strategies i.e. short gamma is an example of carry trading.

## Event-based trading strategies

Event based trading strategies are used to take advantage of price inefficiencies that are formed following the release of economic and corporate events.

In quantitative analysis, news-based stock trading is considered as an event based trading strategy. Read the article Quantified News Analytics: Profitability vs Pitfalls to gain deeper understanding on news-based stock trading.

In fundamental analysis, buying/selling the stock by studying the price changes after the news events and economic events comes under event-based trading strategies.

## ML-based trading strategies

Basically, ML-based trading strategies are the contemporary practice. They are a mix of quantitative, technical and fundamental methods for each of the trading strategies mentioned above namely trending, mean reverting, break out, carry and event based.

The three verticals of ML-based strategies are:

- Supervised learning trading strategies
- Unsupervised learning trading strategies
- Reinforcement learning trading strategies

## Supervised learning trading strategies

The supervised learning method for machine learning models consists of two main techniques, that is:

- Regression (for predicting the real numbers, of any variable such as stocks, commodities etc.)
- Classification (for classifying categories of a variable such as TSLA, GOOGL etc. in stocks)

### Regression

Regression is a statistical process of determining relationships between variables. It helps one to understand how the value of the dependent variable changes when any one of the independent variables is varied.

It also allows comparing the effects of variables measured on different scales, such as the effect of price changes. In trading, regression is used extensively, especially in pairs trading strategy, and when it is required to evaluate the performance of a stock in comparison to market returns.

**Linear regression**

Linear Regression is one of the most widely known modeling techniques. Linear regression establishes a relationship between a dependent variable (Y) and one or more independent variables (X) using a best fit straight line.

If there is only one independent variable, then it is called a simple linear regression but if there are more than one independent variables, then it is called multiple linear regression.

Let us understand this with a diagram shown below:

The above diagram shows the given data for “return on the S&P 500” on the x-axis and the predicted data for “return on stock ABC” on the y-axis. For calculating the regression line slope, you can use the **Scikit-learn** library in Python.

Scikit-learn library features algorithms for supervised and unsupervised models that includes regression techniques, classification, clustering, random forest etc.

To calculate the y-intercept, which is the dependent/predicted variable, the formula goes as follows:

For example, if you calculated a slope of 1.5 and an intercept of 20, the final linear regression formula for the stock is:

y= 20 + 1.5x

Next in the supervised learning method is logistic regression.

**Logistic regression**

Logistic regression is similar to linear regression, but with only one difference. The logistic regression model runs the result through a special non-linear function, the logistic function to produce the output “y”. Here, the output is binary or in the form of 0/1 or -1/1.

Logistic regression measures the relationship between the dependent variable and one or more independent variables by estimating probabilities using a logistic function.

Hence, the formula is as follow for logistic regression:

**y = 1 / 1+ e-x**

### Classification

Classification is one of the methods which is applied using a Support Vector Classifier (SVC) technique and is part of an unsupervised learning method in machine learning. The classification technique maps the input into a discrete class or a category as shown in the image below:

For instance, the categories in the trading domain can be classified as entry position and exit position in any of the following markets - a stock, commodity, bond, derivative.

Recommended read: Machine Learning Classification Strategy in Python

### Random forest

Random Forest, also called Random Decision Forests, is a method in machine learning capable of performing both regression and classification tasks. It is a type of ensemble learning that uses multiple learning algorithms for prediction.

Random Forest comprises decision trees, which are graphs of decisions representing their course of action or statistical probability. These multiple trees are plotted to a single tree called the Classification and Regression (CART) Model.

To classify an object based on its attributes, each tree gives a classification that is said to vote for that class. The forest then chooses the classification with the maximum number of votes. For regression, it considers the average of the outputs for different trees.

**Working**

- Let us assume the number of cases as “N”. Then, randomly but with replacement, the sample of these N cases is taken out, which will be the training set.
- Considering M to be the input variables, a number m is selected such that m < M. The best split between m and M is used to split the node. The value of m is held constant as the trees are grown.
- Each tree is grown as large as possible.
- By aggregating the predictions of n trees (i.e., majority votes for classification, the average for regression), random forest predicts the new data.

For instance, in the stock market, random forest is used to identify a stock’s behaviour (taking the past performance of stock in ‘n’ number of years) in terms of expected returns.

## Unsupervised learning trading strategies

Unsupervised learning is a type of machine learning in which only the input data is provided and the output data (labelling) is absent. Algorithms in unsupervised learning are left without any assistance to find results and in this method of learning, there are no correct or wrong answers.

### K-Means clustering

K-Means Clustering is a type of unsupervised machine learning that groups data on the basis of similarities. K-Means is one technique for finding subgroups within datasets. One difference in K-Means versus that of other clustering methods is that in K-Means, we have a predetermined amount of clusters while other techniques do not require that we predefine the number of clusters.

The algorithm begins by randomly assigning each data point to a specific cluster with no one data point being in any two clusters. It then calculates the centroid, or mean of these points.

The object of the algorithm is to reduce the total within-cluster variation. In other words, we want to place each point into a specific cluster, measure the distances from the centroid of that cluster and then take the squared sum of these to get the total within-cluster variation. Our goal is to reduce this value.

The process of assigning data points and calculating the squared distances is continued until there are no more changes in the components of the clusters, or in other words, we have optimally reduced the in-cluster variation.

Recommended read: K-Means Clustering Algorithm For Pair Selection In Python

## Reinforcement learning trading strategies

Reinforcement learning is a way to encourage or change a particular unwanted behaviour by the system. Whenever the system gets a reward for giving the desired result (as fed to the system), it is positively reinforced and when the system does the opposite of the desired result, it is negatively reinforced. This way the machine learning system learns.

It is very much similar to how human beings learn. When they get the desired result in a field, say, a good score in an examination, they are rewarded with a good job. Here is a diagrammatic representation of how a machine learning model works with reinforcement learning:

Recommended course: Introduction to machine learning for Trading

Machine learning trading strategies are best applied with the help of popular computer language Python. There is a Python package known as Scikit-learn, which is developed specifically for machine learning and features various classification, regression and clustering algorithms.

## Portfolio of strategies

The strategies explained in this article can be combined to create a portfolio. For example, you can combine the strategies under fundamental analysis and technical analysis. Fundamental analysis will be used to select the asset to trade and technical analysis will be used to time the entry.

Now, the market moves in different regimes. So, a momentum strategy may not work properly when market is not trending. At the same time, a mean reversion strategy may not perform the best when market is trending. Hence, you can combine momentum with mean reversion strategies to generate consistent returns.

Here, you can allocate some of the capital to momentum strategies and some to mean reversion strategies (based on expected market situation). Similarly, you can allocate the capital to different strategies depending on the situations such as market volatility (current and expected).

Also, you can trade in a variety of trade-able items such as Forex (currency), equity shares, commodities etc. to create a portfolio and apply different strategies as mentioned above.

Moreover, the strategies namely, trend trading strategies, mean-reverting strategies, break-out, carry and event-based can be modelled with the help of machine learning models/methods/strategies as described above.

Here, combining the strategies will:

- Decrease the overall maximum drawdown
- Increase the stability of returns, and
- Diversify the assets that we trade

### Conclusion

Trading strategy creation is an important step during automated execution of trades. The trading strategy helps execute the trades systematically for making the outcomes favourable for the traders.

There are several trading strategies and each can be implemented depending on a particular market scenario. We discussed different trading strategies with their application types namely technical, quantitative, fundamental, and machine learning approaches.

Enroll into the course Getting started with Algorithmic Trading to find out more about algorithmic trading practice.

*Disclaimer: All investments and trading in the stock market involve risk. Any decision to place trades in the financial markets, including trading in stock or options or other financial instruments is a personal decision that should only be made after thorough research, including a personal risk and financial assessment and the engagement of professional assistance to the extent you believe necessary. The trading strategies or related information mentioned in this article is for informational purposes only.*