Here you will find daily news and tutorials about R, contributed by over 750 bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

In this previous post, I showed that a look at the correlations in the daily returns of S&P 500 should have lead to a very profitable investing strategy. I also promised to show the results of this strategy in the 80s, but I am not going to do that, because MarketSci has done so in several posts already.

Instead, let’s try to find a more recent “arbitrage” situation like that. Looking into more recent history, and using 126 (half a year) days to compute the autocorrelation function, I got back to August the 30th, 2007:

S&P 500 ACF on August 29 and 30, 2007

As the graph illustrates, the correlation moved into significant territory at the close of August 30. There is a significant negative correlation in the first lag. Looking at this chart, our strategy should be “go short at the close of a positive day, go long at the close of a negative day”. This situation (strong correlation in the first lag) seemed to last until February the 2nd, 2008. Computing the returns (some of the code was borrowed from an article on FOSS Trading, code at the end) we get the following equity chart:

Equity Growth August 30, 2007 – February 4, 2008

How do we know to stop trading using this strategy on February 4th? Why, by the ACF graph of course.

Unless I got something wrong looks damn impressive!

Note, that this is not a trading system, it is just an attempt to approach markets in a much more scientific and systemic way.