I am a newbie and this is my first algo post.
I am trying to get the slope of an indicator to determine market trend.
Maybe a more experienced eye can spot my error(s) and give some advice so that others can also learn from my mistakes
I first tried
1) to implement the indicator extentions
See code snippet
'''
#####~~ indicator extensions begin ~~ uncomment the 3's
#Tried to get the slope of the Chanel indicater by using the ROC of the indictor
# the indicator extensions seems NOT working on these two indicators below
self.ROC = RateOfChange(18)
self.meanDCH = float(self.TestIndicator.Current.Value)
self.IndicatorSlope = IndicatorExtensions.Of(self.ROC, self.meanDCH )
#####~~ indicator extensions end ~~ uncomment the 3's below and one line further on line 95
'''
2) My next effort was to use a rolling Window but I know I am missing something but cannot yet determine what..
'''
#####~~ Rolling Window begin ~~ uncomment the 3's above and below codesnipet
# Try Rolling Window to determine the slope of the testindicztor
self.dchWindow.Add(self.TestIndicator.Current.Value)
currentDch = self.dchWindow[0]
previousDch = self.dchWindow[1]
self.IndicatorSlope = currentDch - previousDch
#####~~ Rolling Window end ~~ uncomment the 3's below
'''
Both 1) and 2) efforts gave the same error message: .
[Trying to dynamically access a method that does not exist throws a TypeError exception]
So my inexperience shows the same mistake that seems still a blind spot for me.
3) My last SDF question.
From your experience is it better to build a separate Alpha for say an uptrend market to trade with another momentum Alpha or is it better to combine the momentum alpha and the trend Alpha in a single alpha?
See attached Backtest where my code snippets is commented out
Thanks for your patience with us newbies.
Vladimir
JohanL,
Try this simple and reliable way.
JohanL
Thank you SO much Vladimir for this help.
This give an excellent starting point to implement in my own Alpha code.
I already started but then realised I need a bit more advanced Phyton under my belt and it is first back to basics for me.
I so appreciated your other inputs on the board since it pointed me in the right direction to impliment my own strategy
Have an awesome day!
Vladimir
JohanL
If you are satisfied with my answer, please accept it.
JohanL
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!