A while ago I coded my stock rotation system in Python for others to play with on the Quantopian back testing platform.
This provided me with some very helpful feedback although I have since stepped back from actually coding in Quantpian because it is rather over complex for my needs and in a state of constant evolution.
I continue to try to give feedback on my ideas however and here are recent contributions:
A trend follower wants and needs to avoid false signals due to noise. A trend following model will reap the greatest and cleanest profits when a market breaks out in one direction and never looks back – a perfect (non-achievable!) trend would go from point A at the bottom left hand corner of the chart to point B at the top right hand corner in an absolutely straight line with no retracements.
Kaufman’s Efficiency Ratio as I had meant to draft it has values ranging from 0 when markets are very noisy and a theoretical +1 when markets are perfectly directional.
Any value above 1 indicates an error in the coding.
252 days was chosen because round about a year is generally considered the maximum sensible look back for a momentum indicator.
I have not looked at Q 2 and regrettably do not have time to. Haven’t looked at the calculations for a while.
The one hundred instruments tested were all concatenated futures prices back adjusted to eliminate gaps.
I do not believe one should trade a model such as this by rotating into a small number of stocks, especially if the universe is large. The concept “works” – take the actual trading history of the Guggenheim S&P 500® Equal Weight ETF by example and compare it to the SPY.
But my belief/preference is that one probably wants to rotate into at least 50 stocks and choose a relative small universe – perhaps the top 1000 by market cap rather than 5000 for instance.
You will see what I mean if you back test this system on a mere 5 or 10 stocks out of a relatively large universe on different days of the month. The results will differ hugely. As you increase the number of stocks you rotate into and/or decrease the size of the universe somewhat a measure of stability returns and it begins not to matter which day of the month you choose for your allocations.
In my own trading I divide my trading into 4 subsystems each reallocating on an equally spaced different monthly date. Currently I trade ETFs not stocks and can therefore afford to rotate into a small number (10). But I would not use 10 for individual stocks, personally speaking.
I’m sorry I can’t be of more help on this actual Q version….I have lost track. And am concentrating on my own version in my own back test engine.
One outstandingly good opportunity to curve fit is in portfolio choice. I tried to avoid this. It is often trivially easy to cook up good back tests by careful choice of rules, parameters and portfolio. The choices on my website for TAA1 for my own trading attempt to avoid hindsight bias and perhaps should be simified further. I would be alarmed if my back test s had shown brilliant recent results since last August looking back over the last few years the US had been the only game in town. My object was to diversify very widely without taking too much heed of backtest results. A better benchmark is the MSCI World but even then it is of course very heavily weighted to the US.
I think I have been honest. Whether anyone finds that helpful or not…is another matter. On the various videos and dull postings on my website I try to make it clear that I have no idea what the future holds and that my approach is therefore to allocate to as wide a group of asset classes as possible. And then let the matter simply float on the waves and hope the result is positive.
I make the point that overweighting could be a great mistake. Hence my preference for more equally weighted schemes rather than market cap approaches adopted by most index providers. Japan represented a 40% market cap weighting in the MSCI World back in the 1980s. Was this sensible? The US represents 50% of the MSCI World today. Do you want 50% of your assets tied to one nation, one economy?
Would you have been happy had you allocated 50% to Germany, Russia or Argentine back in 1900? I suspect not.
If people want to gamble heavily in the short term on a scheme for trading which happens to rake in good returns for a period of time, then fine. But that sort of approach so often ends in disaster.
The long view is perhaps a better approach.