Hey y'all,
I'm working on a strategy to submit for a University competition, and this was an offshoot idea I had while developing that. My advisor said that it isn't "flashy" enough to have a good chance at winning the competition, so I'm sharing it here and maybe someone has an idea on how to make it "flashier" or any comments on it, etc!
It's using three asset classes, Gold, Treasuries, and Stocks. We take the RSI of each, then smooth it over the past 4 months or so to get a picture of longer term momentum and remove the noise (I'm specifically interested on other ways to approach this part of it!). Then we rank the asset classes based on this output.
The first asset class is weighted 50%, second is weighted 30%, and the third is weighted 20%. These are just arbitrary numbers that made sense to me, I want to maintain relevant allocation to all three always since I want to stay "diversified", but I want to also allow the momentum ranking to have meaningful impact. I chose to lever it up since I thought unlevered drawdown was low enough that it was worth juicing for return.
I know my code isn't the best, but this community has helped me a lot!
Jared Broad
It doesn't need to be flashy to be profitable! =) Nice work William Patterson!
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.
Michael Manus
nice one......thanks for posting....always happy to learn something new...thanks
Andi Melengu
Out of all the hundreds of possible ways to analyze past price behavior, why did you pick RSI? Is it better than using Keltner channels or Bollinger bands? How about a rolling regression channel? Also, why did you pick the parameters you picked? Do they perhaps optimize "medium-term" forecasting? Lets assume for a moment that you somehow figured out how to pick the most perfect parameters to study past price action... Wouldn't you wan't to know external factors that might affect price? Do you think your model will work when the economy overheats and inflation expectations rise (gold will outperform, yields have to go up, stocks will be expected to return more to account for inflation)? Do you think your model will work equally well when the economy goes into a recession and yields fall? How about stagflation? How about when when the FED increases its balance sheet and artificially lowers volatility? I am not a professional investor, but it doesn't take a PhD to figure out that models break down over time when market environments and cross-market correlations change. A good model will not only seek high returns but also minimize risk.
Andi Melengu
It seems you're attempting to create an "all weather" portfolio. I would recommend you look at university endowment fund tactics to gain some insights. Also, keep in mind that even "all weather" fund models break down sometime when artificial forces interfere with normal market behavior - recent FED massive bond buying is a prime example that artificially lowered yield and distorted many correlations.
William Patterson
The RSI is a pretty standard indicator and the one that I have used the most, not sure how Bollinger Bands would measure momentum exactly unless you mean using the 20sma? That would have too much noise for a long term momentum signal. 120 was just an arbitrary number number I chose to smooth the signal and remove the noise, I just ran it at 100 days and it actually has a higher Return/Max Drawdown.
Similar to the Perfect Portfolio, this maintains at least some allocation in all of the asset classes at all times. This addresses some of the risk, as well as the system adjusts the weights on the asset classes whenever the momentum ranking changes allowing it to adapt to changes going on. A major part of the Perfect Portfolio is it's idea that you do not want to know what is going on, people generally aren't very good at the whole "this time it's different".
Andi Melengu
Your model is very good, but I think it would benefit from fundamental analysis and parameters for cross-asset correlations. Perhaps you could also add "Cash" in your portfolio allocation for instances when correlations break. In the last financial crisis many assets fell accross the board regardless of their merits and cash was king. When the FED started bond buying people drove the price of gold to the stratosphere because they worried about inflation, which never happened because the velocity of money fell even while money supply rose. Another example would be the recent jump in volatility (VIX) - had one been trading it based on price momentum alone they'd be in for a nasty surprize when the VIX spiked higher. For the purpose of a trading competition your model is more than sufficient, but for trading with real money I'm sure you'll want to enhance it to better account for risk.
Roger M. Benites
Great backtest results!
Kevin Baker
That example yields about 17% annual return with 30% drawdown when run between 2007/08/01 and 2012/08/01 (change ConstantFeeTransactionModel to ConstantFeeModel to get it to compile) but so does this version of the Tutorial called Momentum-Based Tactical Allocation. I adjusted it to buy as much as possible of either SPY or BND.
Is this a fair comparison? Which is actually better?
Shile Wen
Hi Kevin,
An easy way to compare two algorithms is by comparing their Sharpe Ratios. However, both algorithms have roughly equal Sharpe, so it’s hard to tell which is strictly better. We can also look at the max drawdown, which are also almost identical, then we can look at the drawdown recovery time, which are both about a year. The Information Ratio might be another thing that is good to look at, which measures the returns against the benchmark, and the first algorithm has a better information ratio.
Best,
Shile Wen
William Patterson
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!