Introduction
Residual momentum is the phenomenon that stocks with greater monthly residual returns (normalized by the volatility of the residual returns) tend to outperform those with less. Research has shown the strategy experiences less exposure to the dynamic Fama-French factors, produces greater Sharpe ratios, and is more robust out-of-sample than a total return momentum strategy. This strategy is claimed to be more stable throughout the business cycle than a total return momentum strategy. It tends to underperform during trending regimes and outperform during reverting regimes. Additionally, this strategy is less concentrated is small-cap stocks than a total return strategy can sometimes be, leading to less trading costs and reducing the effect of tax-loss selling.
Method
Importing Custom Data
The first step of algorithm is to load 3 years of trailing values of the Fama-French factors. We call the AddData method and provide the Fama-French data source URL from our Tutorials repository. We save the loaded data into a DataFrame in the Alpha model.
Universe Selection
In coarse universe selection, we return 400 symbols which have fundamental data with the highest dollar volume. In fine universe selection, we rank the stocks by market cap and return the symbols that are in the top 10%. We only create ResidualMomentum
objects for stocks added to the universe that have atleast 3 years of historical prices.
Calculate Residual Momentum Score
During construction of ResidualMomentum
objects, we manually warm-up the trailing 3 years of monthly returns for the security. We also set up a monthly consolidator to update the trailing returns each month and to recalculate the score. The score is calculated by fitting a linear regression model to the trailing 36 months of data, using the Fama-French factors as independent variables and the monthly returns of each stock as the dependent variable.
\[\begin{equation} \begin{aligned} r_t = \alpha & + \beta_1 * Mkt_t \\ & + \beta_2 * SMB_t \\ & + \beta_3 * HML_t \\ & + \epsilon_t \end{aligned} \end{equation}\]
where \(r_t\) is the monthly return of the stock in month \(t\); \(Mkt_t\), \(SMB_t\), and \(HML_t\) are the Fama-French factor values in month \(t\); and \(\epsilon_t\) is the residual return in month \(t\). After fitting, we test the model on the trailing 12 months of data (excluding the most recent month) to calculate the score. We simply sum the residuals and divide by the standard deviation of the residuals to get the score.
\[score = \frac{\sum{} \epsilon}{\sigma_\epsilon} \]
If a stock's price is below $1 when calculating the score, it's score is set to None
, excluding it from trading during the rebalance.
Rebalancing
We rebalance the portfolio at the beginning of each month. After calculating a score for each security, we long the 10% of stocks with the greatest scores and short the 10% of stocks with the lowest scores, holding until the next rebalance.
Derek Melchin
See the attached backtest for an updated version of the algorithm with the following changes:
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.
Derek Melchin
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!