Backtesting Momentum Investing Strategies Using Google Sheets

MomentumLAB
5 min readMay 22, 2024

--

Momentum investing is a popular strategy that involves buying assets that have performed well in the past and selling those that have performed poorly. The underlying premise is that assets that have outperformed in the past will continue to do so in the future, at least for some time.

In this blog, I’ll walk you through the process of backtesting an absolute momentum strategy using Google Sheets, and I’ll share some fascinating results from my analysis.

Setting Up the Backtest

For this analysis, I used the NIFTYBEES ETF, which tracks the Nifty 50 index. My strategy was simple:

  • Go Long: When NIFTYBEES is above the 200-day Exponential Moving Average (EMA).
  • Hold: When NIFTYBEES is at or below the 200-day EMA.

I collected 10 years of historical data for NIFTYBEES and used this data to backtest the strategy. The tools used were Google Sheets for a straightforward, accessible approach and Python for a more automated and scalable solution.

Google Sheets Backtesting

Google Sheets provides a user-friendly way to handle data and perform basic calculations. Here’s a high-level overview of the steps involved:

  1. Data Import: Load historical price data for NIFTYBEES.
  2. Calculate 200-day EMA: Use built-in functions to calculate the EMA.
  3. Apply Trading Rules: Create logical statements to determine buy or hold signals based on the EMA.
  4. Performance Analysis: Track the performance of the strategy over time.

Results Summary

The backtest revealed some interesting insights into the performance of the absolute momentum strategy compared to a simple buy-and-hold approach.

Comparing Absolute Momentum Strategy with Buy& Hold strategy

Interpretation of Results

  1. Absolute Return & CAGR: The buy-and-hold strategy yielded a higher absolute return and compound annual growth rate (CAGR). However, the absolute momentum strategy still provided substantial gains with less volatility.
  2. Max Drawdown: The maximum drawdown, which measures the largest peak-to-trough decline, was significantly lower for the absolute momentum strategy (-20.19% vs. -36.34%). This indicates better risk management and lower exposure to severe market downturns.
  3. Rolling Returns: While the buy-and-hold strategy had slightly higher rolling returns, the differences were marginal, showing that the momentum strategy held up well over different time frames.
  4. RoMAD: Return over Max Drawdown (RoMAD) was notably higher for the absolute momentum strategy (49% vs. 33%), highlighting its superior risk-adjusted performance.

Analyzing the Performance of the Absolute Momentum Strategy vs. Buy-and-Hold

NAV of absolute momentum strategy v/s Buy & Hold strategy of NIFTYBEES

The chart above compares the performance of two investment strategies applied to NIFTYBEES over a 10-year period: the Absolute Momentum Strategy (in blue) and the Buy-and-Hold Strategy (in red). Here are some key observations and insights:

1. Overall Performance

  • Buy-and-Hold Strategy: The red line representing the buy-and-hold strategy clearly shows higher overall growth, ending with a NAV (Net Asset Value) close to 300 by early 2024. This strategy benefits from capturing the full upward trend of the market, leading to higher absolute returns.
  • Absolute Momentum Strategy: The blue line for the absolute momentum strategy ends with a NAV closer to 250, indicating a lower overall return compared to the buy-and-hold approach. However, this strategy aims to reduce exposure during market downturns, focusing on managing risk and minimizing losses.

2. Drawdowns and Risk Management

  • Reduced Drawdowns: One of the most notable features of the absolute momentum strategy is its ability to limit drawdowns. During market downturns (e.g., early 2020 due to the COVID-19 pandemic), the blue line shows smaller dips compared to the red line. This indicates better risk management and less severe drawdowns.
  • Smoother Growth: The absolute momentum strategy exhibits a smoother growth curve with fewer and less pronounced dips. This suggests a more stable performance, which can be particularly appealing to risk-averse investors.

3. Performance During Bull Markets

  • Catch-Up in Bull Markets: The buy-and-hold strategy tends to outperform significantly during strong bull markets, as seen in the periods from mid-2020 to late 2021. The absolute momentum strategy, while still capturing some gains, lags behind as it occasionally moves to a hold position during market corrections.
  • Consistency: Despite lagging in strong bull markets, the absolute momentum strategy consistently grows, providing a more reliable performance over time without the steep drops seen in the buy-and-hold strategy.

4. Risk-Adjusted Return

  • Return over Maximum Drawdown (RoMAD): As previously discussed, the RoMAD is higher for the absolute momentum strategy (49%) compared to the buy-and-hold strategy (33%). This chart visually supports that statistic, showing that the momentum strategy provides a better risk-adjusted return by maintaining smaller drawdowns.

Conclusion

Backtesting the absolute momentum strategy with both Google Sheets and Python demonstrated that while it might not outperform a buy-and-hold strategy in terms of absolute returns, it offers better risk management with lower drawdowns and a higher risk-adjusted return. This makes it an attractive strategy for more conservative investors seeking to minimize risk while still achieving respectable returns.

Whether you’re a novice investor or a seasoned trader, backtesting your strategies is crucial for understanding their potential performance. Using accessible tools like Google Sheets and powerful languages like Python, you can rigorously test and refine your strategies before applying them in live markets.

— — — — — — — — — — — — — — — — — — — — — —

QuantX-Builder for Mastering Momentum Investing. 4 week comprehensive learning programme.

bit.ly/QuantX-MomentumLAB

— — — — — — — — — — — — — — — — — — — — — —

Resources and Further Reading

Feel free to leave your comments, questions, and thoughts below. Happy trading!

Important Links
Youtube: https://www.youtube.com/@MomentumLab_IN
Twitter: https://x.com/MomentumLab_IN

**Disclaimer:** We are not SEBI registered advisors. Any content shared on or through our digital media channels is for information and education purposes only and should not be treated as investment or trading advice. Please do your own analysis or take independent professional financial advice before making any investments based on your own personal circumstances. Investment in securities is subject to market risks; please carry out your due diligence before investing. And last but not least, past performance is not indicative of future returns.

--

--

MomentumLAB
MomentumLAB

Written by MomentumLAB

Momentum Investing for DIY investors who believe in India's growth story!

No responses yet