Working version of the Dual Momentum Sector Rotation Strategy, based on Gary Antanacci's book Dual Momentum. If the SPY is trending up, strategy re-balances each month to the top 4 sectors (based on yearly momentum) of the SPY. If the SPY is trending down, the strategy moves 100% to the AGG Bond ETF.
Gary's book doesn't specify how the many sectors he invests in at a given time, or if this number may vary based on other criteria. I have used 4 here for simplicity. Wanted to post this to see what you all think, and maybe some additional rules may be that could improve performance (MichaelH, you linked to an algo that utilized the CAPE metric to identify down moves, that may be something to look into).
Michael Handschuh
Benjamin Staiger
Benjamin Staiger
Reuben
Reuben
Reuben
Michael Handschuh
Reuben
Michael Handschuh
// in algorithm MarketOnOpenOrder("SPY", 10); MarketOnCloseOrder("SPY", -10);
JordanBaucke
JordanBaucke
Michael Handschuh
JordanBaucke
//Data Event Handler: New data arrives here. "TradeBars" type is a dictionary of strings so you can access it by symbol. public void OnData(TradeBars data) { var _momSPY = GEMSymbolData["SPY"].MomScore; var _momTbill = GEMSymbolData["BIL"].MomScore; var Bonds = GEMSymbolData["AGG"].Symbol; decimal holdingPercent = 1m; var orderedMomScores = SectorSymbolData.OrderByDescending(x => x.MomScore.Current.Value).ToList(); int numberOfSectors = 4; foreach (var x in orderedMomScores) { Log(">>SCORE>>" + x.Symbol + ">>" + x.MomScore); } }
I assumed that as the 'onData()' event hit it would display the MomScore() during that period (Daily) if this tick fell on that day...Michael Handschuh
if (lastSampleTime.Date == Time.Date) return;
Z. Tripp
Hi Reuben, I am new here but have brief comment. I think you just need to add the "dual" aspect. Invest in all sectors that are positive for 1-year & have 1-year return greater than SPY & have a 1-yea return greater than Bond fund.
To avoid putting too much $ into one sector (like at time of market turmiol or turnign points), only invest 1/3 in each of the top three sectors. If there are only two, 1/3 is in cash. Only one, 2/3 in cash, etc.
Benjamin Ng
Reuben & Tripp, I have modified the original code and tried to add in the "dual" aspect. The code now goes through each of the selected "strong sectors", and applies the "downside protection" method (
) by checking against "TMOM" and "MA" rules. TMOM refers to time-series momentum, whether the asset's momentum is greater than that of the T-Bill. MA refers to moving average, whether the asset is above a certain moving average. If both conditions are met, 25% of the allocation goes to that sector. If only one of the conditions are met, 12.5% of the allocation goes to that sector and 12.5% of the allocation goes to bonds. If both conditions are not met, 25% that originally goes to the sector would be allocated to bonds.
I am trying to implement a custom momentum indicator, to exclude the most recent month from the calculation. Any suggestions as to how this should be done? I have implemented a "MMomentumPercent" class in the code, but can't seem to get it to work.
Reuben
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!