You get recessions, you have stock market declines. If you don’t understand that’s going to happen, then you’re not ready, you won’t do well in the markets. -Peter Lynch
It is currently the end of July 2018 and we’ve been enjoying one of the longest bull markets in history, with sustained growth since 2009 and without a major pullback of more than 10% during that period. Given that many people attribute this bull run due to Quantitative Easing (QE) from the Federal Reserve, and given that they are now pulling back on this monetary expansion, many analysts are predicting an inevitable downturn from this.
Taking a look at history, here’s some data on the longest bull market runs, and what the corresponding drawdowns were afterwards:
Given that I take a statistical approach to investing and trading, I’ve been curious about analyzing past bear markets to determine if I could develop a model that would enable me to have a degree of confidence of when we have entered a bear market, and the probability of the stock market reaching various retracement levels. My ultimate outcome is to create an investment strategy that will allow me to risk a small percentage of my portfolio to maintain or grow my entire portfolio through a 20% or more peak-to-trough broad market drawdown.
Here’s the details of the data I used to conduct this analysis:
Instrument: S&P 500 Index (SPX) Data Range: Jan 1, 1950 to June 1, 2018 Bar Type: Daily Bars Data Provider: Kinetick (www.kinetick.com)
To conduct this research, I utilized the NinjaTrader platform (www.ninjatrader.com) to output price data from Kinetick to a CSV file (Crude, but quick). I then wrote a Python program to read in this data and analyze it before outputting the report to an Excel file via the openpyxl library (https://pypi.org/project/openpyxl/) or generate charts using the either matplotlib library or the Plot.ly service. This Python program is available on GitHub at the link here.
Past Drawdown Analysis
To start with, I wanted to take a look at how much the S&P 500 index would retrace, from the peak to the very bottom, to understand how often major drawdowns would happen and how much they would retrace. To do this, I took the closing prices for daily bars since January 1, 1950, and whenever we were making new lows, calculate the percentage loss from the previous peak. That analysis resulted the following chart:
This chart shows the magnitude of price declines over the last 70 years. As we can see, there are multiple times when price retraced more than 20%. In fact, since 1950, the S&P 500 has had:
- At least a 20% loss 10 times
- At least a 30% loss 5 times
- At least a 40% loss 3 times
Here are the date ranges that had at least a 20% or more loss:
|Start Date||End Date||Total Drawdown||Num Days||
% Drawdown / Num Days
Based on this data, we can start to drill into these time ranges and look for patterns and indicators that would help us to classify a future bear market early on. Next up in part 2, I’ll be taking a look at the System Quality Number (SQN) indicator values during these periods.