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:
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:
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.
Finally the R code:
getSymbols("^GSPC", from="2005-01-01") GSPC.diffs = diff( Cl( GSPC ) ) GSPC.up = lag( ifelse( GSPC.diffs > 0, -1, 0 ), 1 ) GSPC.down = lag( ifelse( GSPC.diffs < 0, 1, 0 ), 1 ) GSPC.both = GSPC.up + GSPC.down GSPC.ret = ROC(Cl(GSPC), 1) GSPC.eq = cumprod( 1 + GSPC.both["2007-08-30/2008-02-04"]*GSPC.ret["2007-08-30/2008-02-04"] ) plot( GSPC.eq, main="Equity Growth Aug 30, 2007 - Feb 04, 2008" )