Hi Folks,
I have implemented a quantpedia.com strategy “Momentum and Reversal Combined with Volatility Effect in Stocks”. In one line the strategy can be explained as “Long stocks with high market capital, high momentum and high volatility keep them for six months and then Liquidate”.
According to Wei’s research paper titled “Do Momentum and Reversal Coexist?”, a large capital stock with high volatility shows Momentum if invested for a time period of around six months. This happens because momentum is generated by gradual information diffusion and/or investor under reaction. The investors under react to stocks with vague information i.e. stocks with higher volatility, so it takes time for the correct price to be found.
Implementation:
- Universe Selection:
- Select top 100 stocks based on market capital.
- The stock price should be more than 10 dollars to prevent this is a standard method used in various researches to exclude unexpected results.
- Selection Data for stocks:
I have stored momentum and volatility in a separate class. And then I have created ConcurrentDictionary to store selection data corresponding to every symbol, with symbol as the key.
- Selection data also contains some other fields used by the program to keep momentum and volatility seven days behind the current date. This is done to avoid bias due to microstructure issues. ( I know this is against SOLID principle of object oriented programming. I will improve this next time.)
- Buying / Selling stocks:
- On the starting of every month. I liquidate all the stocks which are 6 months old.
- Than I look for the most volatile stocks in the current universe.
- Out of these stocks I choose the stock with highest momentum and invest 1/6th part of my cash into this stock.
I have implemented this algorithm using inbuilt classes Momentum and StandardDeviation. Momentum is used for quantify momentum and StandardDeviation is used to quantify volatility.
This algorithm can be further extended to short large capital stocks with high volatility and low momentum. I have tried to do that but the results were not promising, maybe I don’t understand shorting that well or maybe @StephenOehler is right in his post “Thoughts on the risk of shorting”.
JayJayD
Hey Anshul,
Well done! Thanks for sharing.
The implementation is great, at first sight I had some suggestion like use RollingWindow instead of Queue of use IndicatorDataPoint instead the timePrice struct; I even thought in inject the indicators in the SelectionData class with a weekly consolidator. But at the end all those suggestions do not improve the performance nor makes the code more readable ... so I'll K.I.S.S.
Respect to the performance, the 81% win rate is awesome, but in the other hand is a long strategy in a period with a – mostly – bullish market. Maybe implementing a Kelly criterion for sizing can improve the strategy behavior.
Jianbin Lin
Anshul Yadav
Hi Folks,
Dear @JayJayD Thanks for the suggestions I will keep them in mind from next time onwards. It will be awesome if you can enlighten me on Kelly criterion. Specifically, how can we apply it in current scenario.
Please have a look at the following video presentation I made for this strategy. Video
JayJayD
Anshul,
In its simplest form, the Kelly criteria says that the optimal bet (and leverage) you can make in a basket of asset is given by:
Where:
S is a column vector with the optimal allocation for each one of the assets and the sum of the elements of S is the optimal leverage.
C is the variance-covariance matrix of the returns.
M is the vector of the returns.
In this particular case, instead of a fixed leverage and equal weight, you can use the Kelly optimal leverage and sizing every time the strategy rebalances the portfolio.
Anshul Yadav
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!