Can you Time Economic Downturns?

The market can stay irrational longer than you can stay solvent. ~ Keynes

With cries of ‘The Recession is Coming’ in the air, many financial gurus are recommending for people to move their assets into currency and other non-stock financial products.

However simultaneously, the stock market has been going veritably crazy since the latest earnings reports:

Tesla (TSLA) stock gains, from
Uber (UBER) stock gains, from
Apple (AAPL) stock gains, from

Its a perplexing time to be investing. Does this mean the recession has been cancelled? Maybe, maybe not. Theories about about coronavirus and short-squeezes. Readers may recall from our Yield Curve Inversion article, that the stock market tends to often spike just after a yield curve inversion and before a recession:

S&P 500 vs. Yield Curve

So with all the apoplectic clamour— should we even worry about timing the market in the first place? That is exactly what we will explore.

Should the Market be Amenable to Timing?

Many financial gurus, like Berkshire financial wizard Warren Buffet, are rather skeptical of investors timing the market:

Skeptics question his stance, as he has accrued ever more cash in his portfolio — which they contend is a sign that he feels the stock market is overpriced. However an alternative view is that Berkshire’s stake in numerous insurance companies necessitates high cash holdings to balance risk.

Efficient market theory (if one believes it) also weighs against the idea: If a sufficiently strong signal (yield curve, consumer confidence, etc.) exists to time recessions, this should already be priced into the market.

So instead of delving in theory, lets simulate market timing in python!

Simulating Market Timing

The data we will use is an export of Yahoo Finance SPY ETF index data, which tracks the S&P 500. This data already assumes dividend reinvestment.

Our simulation will assume no transaction fees, taxes, etc.

We will first find candidate recession starting and ending points using the scipy.signal.argrelextrema python function. These are the recessions it finds:

Python plot of closing values for historical S&P + dividend reinvestment index.

Lets look at the logarithmic transformation of this data to see the first and last recessions more clearly:

Python plot of logarithm of historical S&P + dividend reinvestment index, with recessions marked in red.

So far so good.

Now, we will simulate how the (rate of return/per month) for cashing out of the stock market changes as our certainty over when the recession starts and ends changes.

We will simulate from between perfect knowledge (0 months of error in start and end month) up to 24 months uncertainty (i.e. being off by ± two years). Here’s the result:

Python graph of rate of return per month for cashing out of stock market vs. knowledge when recession will occur (in months).

As we can see:

  • With perfect certainty, we have over 2% monthly gains for exiting the stock market.
  • If we know the timing of a recession with less than 19 month certainty, we are likely to lose money.

This simulation does not consider what would happen if we pulled our money out and put it into bonds instead. However, the return for 10-year US bonds is roughly 2% per year historically, or at most ~0.16% monthly depending on reinvestment, and as such should not affect this simulation massively.

Of more salient note is that even timing the market within 20 months is an unlikely task, given that we haven’t experienced a significant downturn in over a decade, yet we have had plenty of prominent investors forecasting one!

Addendum — Dividend Aristocrats

The above simulation would have looked slightly different had we focused on so-called Dividend Aristocrats — stocks that have increased their dividend payouts yearly for at least 25 years. As seen in the graph below, their historical performance is slightly superior to the S&P 500 as a whole.


We hope this article has been of interest. You may enjoy our other articles:

The latest financial scoops, from the eyes of quantitative analysis and data science.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store