Remember rising markets?

Almost refreshing after so much turbulence… a steady move up.  Just like the good old days…of last month:

Resembles the days of yore... will it hold?  Source: thinkorswim by TDAmeritrade

Resembles the days of yore… will it hold? Source: thinkorswim by TDAmeritrade

Volatility is duly contracting.  My trade idea yesterday would’ve been a good one (about 50% profit so far), but alas…I’m too chicken.

What to do now?  Pile back in?  The Death Cross says await 1900 on the S&P before getting back in.  The 50 / 100 MA Cross never left the market.  So what’s your plan?

Advertisements

Let’s do some data mining – Death Cross revisited

It’s all well and good looking for the Death Cross signal to tell when to be in and out of the markets…but is that just an artefact of the data?  I’m curious…

We established last time that being long when the S&P500 was above its 200 DMA, then selling when the price closed below the same DMA, was a somewhat ‘meh’ strategy: returns were about the same as being long the entire period since 1950, but risk/return was a bit better using the strategy.  Using the joy of AmiBroker, plus the plethora of free data on offer from Google Finance etc., we can get some idea of how robust the Death Cross really is.

Here’s what I’ve done:

  1. Downloaded all historical data for the investable S&P500 ETF – SPY.  This begins Feb 1993, so has a few ups and downs.
  2. Using AmiBroker, I simulated a realistic-ish simple trading strategy:
    1. Be long SPY if (an exponentially-weighted) moving average of the price (MA1) is above another moving average of the price (MA2).  Let’s not assume the shorter moving average needs to be higher than the longer for the time being.  BTW, a moving average of 1 = the current price; thus the Death Cross is equivalent to MA1(1) > MA2(200).
    2. If the first MA crosses below the second MA, exit the market until they reverse.
    3. Assume we check these values at the close of each day, and transact on the next day’s open.  No cheating!
    4. Assume a flat $9 for each trade.  That’s about average these days for US brokers.
  3. Vary the lengths of MA1 and MA2 over the following ranges:
    1. MA1: 1 day through 80 days, incrementing by 1 day
    2. MA2: 2 days through 300 days, incrementing by 2 days
  4. Record the net profit of each run, and place in large PivotTable.
  5. Colour said large PivotTable to create the below piece of abstract art:
The closest I come to art.  Green = relatively better idea than Red.  Sources: AmiBroker and Google Finance.

The closest I come to art. Green = relatively better idea than Red. Sources: AmiBroker and Google Finance.

Lovely.  Each row represents a different MA1 value; each column a different MA2.  The colour scheme helps us see some interesting patterns:

  1. Longer averages = better results.  The Death Cross result is that small blue circle, deep in the lower-value area of the chart.  Why?  By having such a reactive average (i.e. the underlying price), each time the price falls below the 200 DMA there’s a lot of buying and selling.  For example, if you unloaded yesterday due to the DMA being crossed, you might very well be getting back in tomorrow.  That’s 2 transaction fees for not much benefit.
  2. ‘Sweet spot’ = around 50 vs 100 DMA.  Over this time period, the darkest green area is around the MA1 = 50 and MA2 = 100 days.  I guess this is because those runs run away from the 2008 crash well: the 50/100 run exits Nov 2007, then re-enters June 2009.
  3. Still doesn’t beat returns of long-only.  Even the best run has about a 105% total return (excluding dividends) since 1993.  Buy-and-hold SPY returned over 300% (excluding dividends) in the same period.  But the drawdowns are perhaps more palatable – around 18% Max drawdown for the 50/100 run, versus 55% for long-only.

What are the lessons?

  • Trading momentum strategies, like the Death Cross, helps the risk profile of an equity portfolio.  It doesn’t help the return profile, at least since 1993.
  • Data mining is sometimes very dangerous – if using data analysis to come up with a really good-looking, overfit strategy.  I think it can be a helpful tool to see how robust a strategy is – as in, what if I’ve completely misspecified the strategy?  In this case, you can be really loose about the 50/100 parameters and still come out better than the Death Cross.

Investing and the Death Cross

Much talk of the ‘Death Cross’ these days.  The 200-day moving average (200 DMA) is seen as the indicator for folks to start bailing on the stock market.  The Russell 2000 crossed this level a while back; the S&P 500 crossed its 200 DMA yesterday.  Market prognosticators will now side with:

  1. Trend-followers: time to get out!
  2. Value investors/contrarians: time to get in!

Which one should I be?  Well, let’s go back to our friendly Quandl report on S&P500.  Since 1950, let’s see whether it pays to be in the first or second category:

200dma

The green line simulates the easiest strategy possible – buy the S&P500 in 1950, and hold it forever.  The purple line is the same, except for the following:

  • If the closing price on date t is below the 200 DMA, sell on the opening price the next day.
  • If the closing price on date t crosses above the 200 DMA, buy back in.

I’ve used a log-scale chart, so the time frame doesn’t really matter – you could buy in 1960 or 2000, and the scale of the results aren’t really impacted (aside: do you get angry at investment performance reports showing arithmetic scales, rather than log scales; particularly when covering a long time period??  I find them very annoying, and downright misleading).

Anyway, what do you notice?  The main takeaways, for me, are the following:

  • Exiting at 200 DMA doesn’t seem to matter much in the long run.  Returns are what they are.
  • Position risk looks to be much better when you exit at 200 DMA.  I’m sure many would prefer to have sat-out the 2008/09 crash.
  • In sum: the risk manager will love you for exiting at the 200 DMA.  But your returns may or may not be negatively impacted.