Following on from my PCA posts (1, 2, 3) I decided to write a strategy based on them for the Lazy Backtesting IDE.

Two combined together in fact.

If momentum has been detected, go long when the last day's return is positive and vice versa.

Do the opposite when mean reversion is detected.

Plus, weight long and short holdings by the strength of the evidence of mean reversion and momentum.

The strategy logic weights the S&P 500 as follows:

AutoCorrelation(500 Daily Returns) * abs(Previous Day's Return) / Previous Day's Return

Code is here (thanks to Bill H. for pointing out a bug).

The Sharpe over 55 years is 1.5, which is equivalent to a Sharpe of 40 over a 10 year backtesting period.

I wrote recently how I was not comfortable with Sharpe's profitability hypothesis testing.

In fact in some formulations of the strategy I saw a 10 year equivalent Sharpe ratio of infinity.

Drop the mic!

At the moment my favourite risk analytic is 'Max Wait'.

The max wait of this strategy is 7 years. 1 year lower than the S&P 500.

This means that there have been chunks of 6 years where the strategy has been unprofitable, however with 7 year chunks the strategy has been consistently profitable.

I scaled the strategy's returns so that the returns are equal to the S&P 500 over the last 55 years, i.e. the area where the strategy underperforms is equal to outperformance (the strategy's vol remains far lower however!).

There is virtually zero correlation between the strategy's returns and the S&P 500 and yet, what jumps out is that it performs best during times of stress.

Mean Reversion + Momentum eats Credit Crunchies for breakfast.