I'm tried a million things but I can't fix this error
My line 20 is self.Schedule.On(self.DateRules.Every(DayOfWeek.Monday
During the algorithm initialization, the following exception has occurred: AttributeError : 'ScheduledEventsAlgorithm' object has no attribute 'SpecificTime'
at Initialize in main.py:line 20
AttributeError : 'ScheduledEventsAlgorithm' object has no attribute 'SpecificTime'
Any ideas?
Also is there an easy way to copy and paste my project code?
Adam W
Can you paste the full scheduling code (i.e. lines 21-22)? You can attach a project if that makes it easier.
Jack Simonson
Hi Michael,
Can you attach a code snippet or a backtest of your project as Adam mentioned? It will help us easily identify the issue and provide you with a solution.
Fireball
Â
Fireball
Figured out I could screenshot and upload to imageshack!
Adam W
The function you are calling, .SpecificTime(), has to be an attribute of the base algorithm:
class ScheduledEventsAlgorithm(QCAlgorithm): def Initialize(self): self.Schedule.On(self.DateRules.Every(DayOfWeek.Monday), self.TimeRules.At(*arg) ## Don't forget this part self.SpecificTime) def SpecificTime(self): if not self.Portfolio.Invested: # Do something
There's also a couple of other issues here and small design tips:
Fireball
Thanks! I think I captured most of your comments. I have it running now, but no trades are excuting which makes me think I have something else fundamentally wrong. There should definitely be situations where the EMA 8 is above or belowthe EMA 55 for entry. Added the backtest and an image of code.
https://imagizer.imageshack.com/img923/9481/VmoTiO.pngÂ
Fireball
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!