The Average Investor's Blog

A software developer view on the markets

Market Timing Strategies

Posted by The Average Investor on Apr 3, 2010

What constitutes a good market strategy? Of course, the answer varies from person to person. Based on my experience, I came down with the following requirements for a market strategy which I would use in practice:

  • The strategy must be long term – short term trading is too much stress.
  • A proven and verifiable track record for the strategy. As a minimum, there should be enough data to test the strategy over a reasonable amount of time. Few years, is ok, few decades is better.
  • The strategy should be completely mechanic – no close calls and “I can do better in practice”.
  • The vehicles traded must be liquid and stable. The risk should be low – prefer index to stocks.

After toying for a while with the Dow Theory, I was fortunate enough to come upon The Ivy Portfolio book, which was showing the benefits of a simple market timing model for various classes of assets. At first I was quite skeptic, by that time I was already tired of “working” systems, which fell apart completely once they were put to a test. However, the idea in the book was so simple that I decided to give it a try.

Instead of using the popular 200 day moving average, the author was using it’s “equivalent” – the 10 month moving average. To try the system, all one needed was a computer with R and the quantmod package.

First I needed the data, so I decided to use S&P 500. Yahoo provides historical data for S&P 500 since 1950. From the R window I did:

library(quantmod)
getSymbols("^GSPC", from="1900-01-01")
gspc = get("GSPC")
gspc.monthly = to.monthly(gspc)
lineChart(gspc.monthly["1998/"], TA=NULL, name="S&P 500 Montly & 10 Month Moving Average")
addSMA(10)

These commands produced the following nice chart:

The chart looked pretty promising. In brief, the system is: “in the market when the price is above the moving average, in treasuries otherwise”.

The last 10 years have been pretty tough (how did you do?), but a follower of this system would have been saved from the devastating effects of the last two bear markets almost completely (the small exception is a premature buy in April 2002, followed by a sell at the end of the month, that’s where the green line touched the red line – care to guess how much of a loss was this trade?).

The next thing to check was the actual performance. Here are the trades (starting at the first crossing):

Date In Price In Date Out Price Out Gain/Loss
2002-04-01 1147.39 2002-05-01 1076.92 -6.14%
2003-05-01 916.92 2004-08-01 1101.72 20.15%
2004-11-01 1130.20 2007-12-01 1479.63 30.92%
2009-07-01 920.82 27.19%

The last trade is still open – the system is still long. Wow, needless to say, I was very excited! An astonishing 87% (the result of the accumulative compounding – 1*(1-0.0614)*(1+0.2015)*… etc) increase of the initial capital, with only four trades. That’s without adding any potential gains of being in treasuries when out of the index. I was very excited – aren’t you?

Time to wrap up this post, but before doing that, let’s get back to our earlier question about the “price” of the fake crossover. Notice how misleading a chart can be. It is counter-intuitive to guess that the fake crossover in 2002 will lead to a loss of more than 6%! Keep it in mind next time when you come across the next flashy chart in a commercial of a trading system guaranteeing outstanding profits.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: