This is one of my first QC Framework algorithms.
I found that the Carsten code, with some exceptions, is very similar to Andreas Clenow Momentum.
I made some changes to match the original.
I would like someone from the QC team to check and comment on whether everything
was applied correctly.
Carsten
VladimirÂ
I played a lot with Andreas Clenow Momentum...but I never found a hughe edge compared to the standard momentum (delta returns). BUT just using the Slope in this case improves.
The slope is by its self already a filter. What I found improves as well, is to set a treshold for the R2 or using volatility.
I do not understand why the original version (ACM) does not improve much over classic returns, as it is a cool idear....
...and i found, to get he right ETF's is a key, not too crasy and not too sleepy, like FDN :). I was trying to get around 3-4 ETFs for each side of the market like GLD, TLH, TLT and than QQQ, SPY, some thing with more power :). I was running this on zipline before and (you get a better view on pyfolio) there is a period were neither market nor the bond perform well. I tried to add some world ETFs but no improement...Â
Are you aware, that you changedÂ
ordered = sorted(self.indi_Update.items(), key = lambda x: x[1].Value, reverse = False)[:self.N]reverse to FALSE, which means that you get the ones with the lowest momentum, you basicly only invest in the bond most of the time? (its smal to big, right and with [ : X], you grab the first X, in this case the small numers...isn't it?)
i changed it to true, but than you get a nice draw down :)....probably on needs more ETFs for these kind of momentum strategies. Unfortunately i did not find a lot ETFs dating back to earlier than 2010
Â
Vladimir
Carsten,
reverse to FALSE, which means that you get the ones with the lowest momentum,
you basicly only invest in the bond most of the time?
I think the strategy works the other way around.
Here is Equity from the Report Summary.
Vladimir
Changed code to prevent "SPY" trading.
Vladimir
Here is Equity from the Report Summary.
Carsten
Vladimir
you are right! i was alway looking at that blue alpha asset...and it minght not be updated at the end.
I didn not new the report - thanks.
Bottom line, my original code was bs, have to look how i did it on zipline - results are different. There might be a bug in the code. The original results from Zipline and Quandl data were around 15% CAGR and 10% DD. If you are interrested i can send the zipline notebook to you.
I have an other idear: what about 2 alphamodel, one does Momnetum on QQQ and friends and the other one does Momnetum on Bonds and friends. Than we build  IN-OUT as a custom indicator to switch between the two alphamodels. What do you think?
Jack Pizza
be weary with statistics from Quantopian, I found multiple faulty price data in their pipeline, with their excuse being we leave it in production to debug..... assuming it was widespread because their DD performance numbers would usually be rosier for some reason.Â
Vladimir
Carsten,
I have an other idea: what about 2 alphamodel, one does Momentum on QQQ and friends
and the other one does Momentum on Bonds and friends.
Than we build IN-OUT as a custom indicator to switch between the two alphamodels.
What do you think?
This is exactly what I did in "DUAL MOMENTUM IN OUT", but in the classic.
So let's do it there.
Start with a custom conventional momentum indicator for alphamodel.
self.RET = 126; self.EXCL = 5;
returns = prices[-self.EXCL] / prices[-self.RET-self.EXCL]
Carsten
 VladimirÂ
I'm trying this next....just finished this one Connors Crash mean reversion short with mixed results. It's still not performing like it should. It would be an intersting strategy if you would like to run several in parralel. It should have low correlation to a classic momentum strategy.
Are you running lean localy? should be way faster. Quantopian was as well superslow compared to zipline.Â
Â
Vladimir
Carsten,
What about custom conventional momentum indicator for alphamodel.
Alphamodels are much faster than classic ones.
Let's do it in "DUAL MOMENTUM IN OUT" thread.
Carsten
Published it in the DUAL MOMENTUM IN OUT
Vladimir
Carsten,
When I run "ETF with In-Out as AlphaModel v2" I get an error:
Runtime Error: UnboundLocalError : local variable 'up_down_signal' referenced before assignment
 at Update in main.py:line 203
 :: if up_down_signal == True:
 UnboundLocalError : local variable 'up_down_signal' referenced before assignment
For comparison, try the same tradable symbols, parameters and momentum as in the classic version.
self.RET = 126; self.EXCL = 5;
momentum = prices[-self.EXCL] / prices[-self.RET-self.EXCL]
Carsten
fixed it, could you try please
Published it in the DUAL MOMENTUM IN OUT
Carsten
Vladimir , just an other topic...are you running lean locally? I just installed it on a mac and could get a simple buy and hold algo running as expexted with my local Quandl data. I just recognised that one needs to specify DataNormalizationMode.Raw, to get the correct results. Its ok with that simple algo, but the more complicated ones are giving out something close to zerro. If you could proide some help it would be great. Thankx
Derek Melchin
Hi Vladimir,
Great start on this algorithm! Here's some ideas for improvement:
These changes are shown in the attached backtest.
Continuing with development, consider:
Best,
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.
Carsten
  Derek Melchin thanks for the feedback on the code.Â
If i undersand you correctly, there is no need to update the indicator in def Update(), becuse RegisterIndicator() takes care of it?
I would like to improve the indicator further. I noticed, that a build in indicator do not need a warmup. Looks like after using RegisterIndicator() this is taken care of.
This would as well remove one of the two Updates insde the indicator and remove the warmup part.
Could i do this with the indicator? I'm not sure if thats a custom indicator class, what I build. I used before the class My_Custom(Custom): but could not get the self.IsReady working properly. Than I skiped the Custom in the bracket and got it somehow working.
Is the some way to get it behaving as a build in indicator? no more warmup neccesary?
Thanks Carsten
Vladimir
Hi Derek,
Thanks for the improvements and recommendations.
Here is the version with consolidated SPY equity.
I really don't understand why we need these 9 lines of code if simple
   mkt_price = self.Securities[self.MKT].Close
would do the same?
Â
Vladimir
Hi Derek,
This picture can explain why I choose reverse = False,
Â
Carsten
Hi Vladimir, did you got the Framework version running?
Derek Melchin
Hi Carsten,
That is correct. Here's example of using `RegisterIndicator` with a custom python indicator.
Best,
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.
Vladimir
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!