A trend-following strategy is the most popular one amongst traders since the trader, based on the trend of a stock, can decide to go long or short on that particular stock. In May 2022, it was observed that an index of leading trend-following strategies run by Societe Generale was up more than 26% year-to-date ⁽¹⁾.
Let us find out much more about trend-following strategies and the five most commonly used trend trading indicators with this blog that covers:
What is a trend-following strategy?
Trend-following strategies are strategies where you simply ride the trend, i.e. buy when the price is going up and sell when the price starts going down (both for a prolonged time period). With trend-following strategies, one does not aim to forecast or predict, but one simply needs to keep an eye on the market for any emerging trends.
Example of trend-following strategy
Let us take Amazon’s stock as an example of trend-following strategies. In the image below, I have marked two blue lines where the price of Amazon is showing two trends, that is, uptrend and downtrend.
You can see clearly in the image that, in the year 2020, around the month of May, the price of Amazon’s shares kept going up and even further mostly remained in an upward trend only.
It is clearly visible that, till May 2022 there were mostly higher highs and higher lows in the price. In the case of an uptrend, the trend trader goes long and buys shares in the hope of prices going further up.
But, you can say that in May 2022, the price of Amazon’s shares mostly went down and the blue straight line shows a sharp downward trend followed by lower lows and lower highs.
In the case of a downtrend, the trend trader usually goes short and prefers selling the stock. If the trend goes below a certain point, the trend trader even exits the market.
How does a trend emerge?
While we use algorithmic trading i.e quantitative trading strategies to curb sentimental trading, the same can also be used to utilise and monetize sentiments. We have all heard of things going viral, thanks to the power of the internet. It’s the same concept, albeit, with a different goal.
In the financial world too, there is FOMO (Fear Of Missing Out), although here, the reason is a general desire to be on the winning side. Hence, the trends emerge as a result of human emotion and the desire to follow the crowd since a group of people can base their trading decision on an emotion triggered by an event. And, the others follow!
Types of trends in trading
Trend-following is the most common and popular trading strategy owing to the vital role trends play for a trader. The trends are important because a trend can help a trader identify the entry and exit positions in the financial market (stock, commodity, currency etc.).
Hence, a trader can follow the trend and buy (entry) the stock in case of an uptrend and, in case there is a reverse trend, the trader can sell (exit) the stock.
Here are the three different types of trends in general:
- Sideways trend
An uptrend implies that the stock price is rising in value. In case of an uptrend, the traders aim to take advantage by entering the long position in order to sell it later at a high price.
For instance, if the price of a stock increases by $40 and reduces by $20, and then again rises by $25 to reach 45, the stock price is in an upward trend since it shows higher highs (the increase in price is taking the price line towards upward direction more often) and higher lows (the occasional decrease in price is not taking the price line towards downward direction) in the price.
In case of a downtrend, the stock price faces a fall in value. During the downtrend, the trend traders enter a short position. And, when the stock price seems to be falling below the lowest possible point (which makes the price too less), the trend trader prefers selling the stocks and exiting the market.
For instance, if the stock price decreases by $70 and then increases by $40 and then again falls by $50 to reach $80, a trader will see a formation in a downward trend.
It shows through the lower highs (the occasional increase in price is not taking the price line towards upward direction) and lower lows (the decrease in price is taking the price line towards downward direction more often) in the stock price during a downtrend.
The sideways trend implies that the market is static, i.e., the stock price neither reaches the highest price point nor the lowest point. Usually, trend traders ignore the sideways trend, but scalpers take short term positions in the market in order to take advantage of the sideways trend.
Implementation of trend-following strategies
Trend-following strategies aim to leverage market scenarios profitably. The reason is the high amount of risk and equally high amount of benefits attached to the same.
No single indicator can predict a secure way to buy or sell a security. However, there are a few famous ones which are employed frequently to gain an analytical perspective and logical decision-making.
The following are the best trading indicators which will help create trend-following strategies:
- Moving averages
- Bollinger bands
The moving averages indicator is a widely used technical indicator that is used to arrive at a decision that is not based on one or two episodes of price fluctuations.
A set of historical data can be employed to observe the price fluctuations of the stock for a predetermined period of time. The same assists in depicting the general direction of the trend flow.
Using moving averages in trend-following strategies
Moving averages provide a clear idea of whether to take a long or short position on the stock. If the stock depicts a negative trend i.e. the price is below the moving average, take a short position (sell) on the stock.
On the other hand, if the stock price is above the simple moving average, one has to take a long position (buy) on the stock because there is an expectancy of the stock price rising further.
Plotting moving averages in Python for trend-following strategies
Before we plot the moving averages, we will first define a time period and choose a stock so that we can analyse it. For this article, let us keep the range from 1st January 2020 to 1st January 2022, and the company details to be used is Tesla (TSLA).
Thus, importing the relevant library and defining the period in python is given in the following code:
Now, we plot the SMA and EMA of TESLA, using the following python code:
Now, we will plot the graph showing SMA30 and EMA.
The graph plotted is shown below:
In the graph above, the Adj Close line is going along with the EMA line, and hence, Adj Close line is overlapping EMA line.
Bollinger band indicators are signals plotted on a singular line which represents the price fluctuations for a particular stock.
Bollinger bands consist of three lines –
- Upper Bollinger band
- Middle Bollinger band
- Lower Bollinger band
The upper and lower Bollinger bands are plotted as two standard deviations away from the mean average. The two signals or bands are plotted to measure the volatility of the price fluctuations.
How to use Bollinger bands in trend-following strategies
When markets become more volatile, the distance between the signals increases or in short the bandwidth widens and the reverse for low volatility. Higher the volatility, the higher the cue for quitting the trade.
The reason the Bollinger bands are plotted two standard deviations away from the mean average is to make sure that the distance between the two bands comprises more than 80% of the price action, thus making any price above or below the bands highly significant.
Plotting Bollinger Bands in Python for trend-following strategies using the same stock TSLA
The python code is given below:
The Moving Average Convergence Divergence indicator (MACD) is a comparative analysis of two moving averages for two different datasets.
Depending on the bandwidth of the time series, you can assess the price fluctuations for two different stretches of time. Say one for a span of a month and another for 200 days.
Comparison of the moving average for these two data sets is done based on three main observations viz convergence, divergence and dramatic rise.
Using MACD in trend-following strategies
If the price fluctuations for one data set are less than the moving average while for the other data the fluctuations are above the moving average, it is wiser to take a short position on the stock because the price variation is not stable.
Plotting MACD in Python for trend-following strategies
The python code is given below:
In the graph above, when the blue line crosses above the orange line, long entry signals are generated.
In other words, when the MACD line crosses the signal line from above, a buy signal is generated.
Hence, buy if MACD line > Signal line.
The Relative Strength Index, i.e., RSI indicator is calculated using the following formula:
RSI = 100 – 100 / (1 + RS)
RS = Average gain of up periods during the specified time frame / Average loss of down periods during the specified timeframe
RSI is used to measure speed and change of the price fluctuations. This indicator provides an idea of the security’s recent performance in the stock market. It measures the strength of the stock in the range of zero to a hundred.
Using RSI in trend-following strategies
A stock is considered overbought over the range of 70 and oversold below 30. You can modify your trading strategy accordingly.
Plotting RSI in Python for trend-following strategies
The python code is given below:
In the image above, you can see the close price as a blue line and the RSI as an orange line.
The On Balance Volume (OBV) Indicator is a momentum based indicator that measures volume flow to gauge the direction of the trend. Volume and price rise are directly proportional.
A rising price is depicted by a rising OBV and a falling OBV stands for a falling price. If OBV depicts a rise in the same pattern as the prices this is a positive indicator. While a contrast with the pattern depicts a negative indicator.
Using OBV in trend-following strategies
OBV is used as a confirmation tool with regard to price trends. If the OBV increases with respect to the increasing price trend, it can be inferred that the price trend is sustainable.
If, however, the OBV shows a decline with respect to the increasing price trend, then it could signal a price trend reversal.
Calculating and plotting OBV in python for trend-following strategies
The python code is given below:
Now, let us visualise OBV.
Pros of trend trading strategy
Let us now see the pros of trend trading.
The tendency of finding the major trends
When the market is gaining a good momentum (Learn momentum trading strategies in detail in the Quantra course), the trend traders go long and that is the essence of trend trading strategy. If a trend trader follows the trends with this strategy, there are numerous chances of catching hold of the uptrend. Some trends even last for years and hence, the trend trader can keep an eye on gaining from such continuous uptrends.
Less time consumption
A trend-following strategy does not need much of the time of a trader and hence, can be used by those who happen to not find much time during the day. trend-following strategy can be adopted by those who look for overnight trading.
Lower transaction costs
Trend traders do not need to spend much on transaction costs because the trend following strategy is a slow paced one unlike the day trading where transactions are placed quickly. Hence, this is yet another of the advantages of trend-following strategy.
Cons of trend trading strategy
Let us not find out what are the cons of a trend trading strategy that you need to be aware of, and these are:
Riding a trend can be hard!
Even though it might sound easy to just ride the trend until the end, that’s seldom the case.
Every time you enter a new trade, you never know how the market is going to develop. Thus, you may be inclined to exit a trade as soon as you have made a little profit, at least to keep what you’ve got so far.
You can not afford to miss any trend related opportunity
As a trend follower, you’re basically waiting for those few trades that will turn the tables, and make your trading a positive venture. This means that you never want to miss an opportunity since any trade could be the one which makes all the difference.
Of course, you should always follow your trading strategy as closely as possible, but with other trading styles where profits tend to be more evenly split between trades, a missed trade or two usually doesn’t make that much of a difference.
A trend-following strategy is simple and can be used by the trader to foresee the stock price and to find out the best time to buy or sell the stock. One can simply use one trading indicator or a combination of the indicators to create the strategy.
Begin your trend trading journey with our course on Technical Indicators Strategies in Python and learn more about building your own trend-following strategies. With this course you will learn how to identify trends in the underlying security price and the way to generate the trading signals. Also, you will learn how to analyse the performance of strategies based on these indicators (with historical data) and live trade these strategies.
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.