Using Moving Averages Crossover Strategy Effectively
Moving Average crossover strategy is one of the simplest strategies used in trading. In this blog, I will talk about the advantages, disadvantages, conveniences, etc. of this strategy. In the end, I will tell you how I can assist you in customizing this strategy for your use.
Moving Average is one of the first concepts that a trader learns in technical analysis. It is the average price of a security, calculated by averaging the prices over a certain period of time.
So, a 100-day Simple Moving Average (SMA) is equal to the average of prices for the last 100 days. Another commonly used moving average is Exponential Moving Average (EMA) which gives more weightage to recent price data. There are many other types of moving averages also, but in this blog, I will focus only on SMA. To learn more about moving averages, you may read this article on Investopedia (click here).
The following chart is an example of the 100-day SMA of Reliance Industries Limited.
Traders use moving averages for varied purposes, such as for identifying trends, finding supports & resistance levels, filtering out stocks, taking pullback trades, crossovers signals, etc. In this blog, I will focus only on Moving Averages’ crossovers.
What are the Moving Average Crossovers?
Moving Average crossover is a strategy to enter and exit an instrument based on crossover & crossunder of one moving average over the other. It uses two moving averages: a fast-moving average and a slow-moving average. A BUY trade is taken when the fast-moving average crosses over the slow-moving average, and a SELL trade is taken when the fast-moving average crosses under the slow-moving average.
Let’s take two moving averages - a 30-day SMA and a 100-day SMA. Here, 30-day SMA is our fast-moving average and 100-day SMA is our slow-moving average. Using the crossover strategy, BUY trades will be taken when 30-day SMA crosses over 100-day SMA and SELL trades will be taken when 30-day SMA crosses under 100-day SMA. Pretty simple, isn’t it!
Using this strategy on Reliance Industries Limited (NSE: RELIANCE)
For a real-life example of this strategy, let’s consider the last 8 years of Reliance Industries Limited. I believe it is a perfect example to explain the advantages & disadvantages of using this strategy.
I have divided the chart into 2 parts - first a period of 4 years from January 2013 to December 2016 and the second - a period of 4 years from January 2017 till now i.e. October 2020. In the first period, the stock moved a little. It gave an overall return of only 28% during this period. In the second period, the stock became 4x, giving an overall return of around 300%.
The period from Jan 2017 till now
Check out the chart below, where I have put the crossover strategy on Reliance Industries in the period from Jan 2017. BUY trades are taken whenever the green line (the 30-day SMA) crosses over the red line (the 100-day SMA) and SELL trades are taken whenever the green line crosses under the red line. Prices mentioned in the box are the closing prices on the days of crossover and crossunder respectively. Percentages mentioned therein are the gains/losses over the buy price.
Result: 5 trades in total, with a return of ~150% (assuming last trade is exited at the current price of Rs. 2165 (as of 20th Oct 2020). So, although this period has an overall return of 300%, using the simple moving average crossover strategy gives you only 150%. Note that the primary reason for using the Moving Average crossover strategy is to eat the majority of the Trend. You will never be able to enjoy the whole trend.
The period from Jan 2013 till Dec 2016
Now, the above-mentioned period of Jan 2017 till now showed you the nicety of using the moving average crossover strategy. Reality is not that good. The strategy is not free from whipsaws i.e. there are false signals too.
Look at the below picture, where using the same strategy (30-day crossover of 100-day SMA) is used for Reliance Industries during the period from Jan 2013 to Dec 2016. There were 7 trades during this period, with a Net Loss of 12%, even though in reality, the stock moved up by around 28%.
Can these whipsaws be avoided?
See, the fact is that all strategies work sometimes, and no strategy works all the time. This is true for the moving average crossover strategy too. So whipsaws and drawdowns cannot be entirely avoided, but these can be curtailed to some extent.
One can use a trend filter, such as a third moving average, which is the slowest of the above two moving averages. For instance, in addition to the crossover and crossunder rules, we can put a condition that the BUY trades will be made only if both fast and slow SMAs are above the 200-day SMA; and SELL trades only if they are below the 200-day SMA. This will reduce the number of trades and certain whipsaws.
Or, instead of a third moving average, we can put a simple breakout condition. For instance, we can put a condition that the BUY trades will be made after the crossover only when the price closes above the highest high of the last 50 days after the crossover or the highest high of the last 50 days on the date of crossover, whichever is less. Similarly, SELL trades will be taken after the crossunder only when the price closes below the lowest low of the last 50 days after the crossunder or the lowest low of the last 50 days on the date of crossunder, whichever is more. This, according to me, is a better filter than using the third moving average condition.
Moving Average Crossover with Breakout condition
Let's see how the 30-day SMA over 100-day SMA crossover strategy looks like, using this simple breakout condition.
For the period from Jan 2013 - Dec 2016, there is not much difference in terms of overall returns. The strategy, with breakout condition, resulted in a Net Loss of 14%, compared to a Net Loss of 12%, without the breakout condition. But the number of trades reduced from 7 to just 3 (the last trade is not considered because it didn't result in exit within the same period).
A lesser number of trades, with similar results, is a better strategy than a higher number of trades.
For the period from Jan 2016 till Oct 2020, there were 3 trades (the first trade coming from the previous period), with an overall return of around 157%. Again, the overall returns are not much different. The strategy gave us 150% returns, without using the breakout condition. But by using the breakout condition, the number of trades reduced from 5 to 3, which is an improvement.
Now, in all the above scenarios, I have not considered SHORT trades on crossunders. Also, the results will be different if EMAs are used instead of SMAs. Similarly, different results will be achieved if the number of days for each moving average or breakout period is changed.
Using smaller durations such as a 10-day or 20-day moving average for a crossover with a 50-day or 75-day moving average will result in frequent trading, whereas using higher duration moving averages will lead to a lesser number of trades.
Some Important Points before you start using this Strategy
Use the Moving Crossover strategy for a diversified portfolio instead of a concentrated one. Even better if you use this strategy with a combination of different markets, such as including certain commodities & forex along with stocks.
It works better on large-cap stocks than mid-cap or small-cap stocks.
Remember that this strategy makes money when there is a clear trend. When there is no trend, i.e. when the market is chopping up & down giving sideways movement, this strategy loses money because of false signals. That's where the breakout rule comes in handy.
Stop fine-tuning the parameters for a beautiful looking chart. Adjusting the number of days from 30 to 25, or from 100 to 75, etc, or using EMA instead of SMA will only change historical returns. But, how will you trade that historical chart? Remember that it is not the parameters that make money, but consistently using the strategy takes you to the end objective.
Now, how can I help?
You can use the above code for the Moving Average Crossover strategy on TradingView for FREE. You can choose the type of moving average (SMA or EMA), the periods for calculating fast & slow moving averages, periods of breakout & breakdown in case you wish to use the breakout condition. Just leave your Email id and TradingView username here and I will give you the access.
If you want customization, there here is a sample list of what I can do for you:
Add more features, filters, conditions, etc. in the strategy such as the use of RSI, MACD, ADX, Bollinger Bands, additional Moving Averages, Higher Timeframe pivot levels, etc. There are endless possibilities.
Add Stop Loss, Profit Booking levels, with alerts.
Add Real-time Instant Alerts whenever a BUY or EXIT signals come.
Alerts can be added for the preparation of the Watchlist also. So, whenever a stock is about to give BUY/EXIT signal but has not yet given it, it will appear in your Watchlist.
You can receive the alerts directly on Telegram too.
If you have any feedback, feel free to leave a comment.