Now that the GTAA system ( is up and running I thought it would be a good idea to drill down and apply some momentum concepts within asset classes instead of just accross them. So, in this thread I'll develop a stock rotation system using the Nasdaq 100 constituents.
First of all the data. Attached to this post you will find a mysql database with daily OHLC/adjusted close/volume data for all stocks included in the Nasdaq 100 index since 2001 (nq100.rar). This includes delisted stocks. Assembling this dataset has probably been the single most annoying thing I've done in my entire life. Nasdaq doesn't even release up to date data on index constituency changes. Companies change tickers and it's reported nowhere. Different companies use the same ticker. Mergers between companies in the index are again reported nowhere. And of course data on delisted stocks is nowhere to be found, not to mention all the cleaning that had to be done. But...here it is! A small number of symbols are missing volume data and I'll try to get that fixed in the future. I'd love to have it go back another decade, but the further back you go the harder it is to get good data so that'll remain a dream for now.
Also note there are still significant problems with the dataset; the number of symbols included swings from -7 to +8 from the actual number. I'm still working on correcting these errors but I feel it's good enough to start running some tests right now; I don't think there's a significant bias to the errors. I'll be updating it as I make improvements.
I'll be using this opportunity to learn C# as well and I'll be posting the code. I could write the system and do the backtests 20 times faster in MATLAB but I want to switch to MC.NET so I gotta learn the language. This is literally the first C# program I've ever written (really, not even a hello world) so expect slow, ugly code and dirty hacks all over the place. I'll try to keep it well-commented though in case anyone wants to dredge through it [the equity curve stats generation might be an interesting bit, it's a compiled matlab function]. I'll still do some of the analysis of the results in MATLAB for now though, to save a bit of time.
The basic principle of the approach is very similar to the GTAA system: we rank stocks based on momentum and pick the top ones. Then we'll add a bunch of filters, other ranking approaches, different weighting methods, risk management, asymmetric entry/exit, perhaps even incorporate some mean reversion patterns, etc. on top of that and see what happens. The benchmark will be QQQ.
The goals are simple: to add some (semi-?)permanent equity exposure to complement the GTAA allocation, and to do this in a way that provides superior risk-adjusted returns compared to our benchmark. A secondary objective is for the system not to underperform the benchmark for long periods of time, for (psychological) tradeability reasons. Additionally, the approach must be fully systematic and require very little time spent on executing it.
The in-sample period used will be 1/1/2001 to 1/1/2008; the out of sample period will be 1/1/2008 to 15/6/2012. I think that will give us a good variety of market environments in both samples.
Note: you may need the matlab compiler runtime (] to run (and compile?) the program.
Some links for inspiration:
Rotational Trading: A simple but powerful system [II./II.] ? Engineering Returns (
Rotational Trading: Stay with the best ? Engineering Returns (
Rotational Trading: how to reduce trades and improve returns ? Engineering Returns (
Finally, the first pic shows our starting point: the returns for simply picking the top 10 assets by ROC 200, rebalancing every Friday, equally weighted. It completely destroys QQQ on pretty much every dimension, but hopefully we can do far better than that by adding a few bells & whistles.