I was sent here after communicating with the support team over email to seek advice on how to solve this strange bug. I implemented a history lookback into an already working algorithm using the code from the Documentation as you can see in the snippet below.
def OnSecuritiesChanged(self, changes):
for security in changes.AddedSecurities:
self.Small = self.EMA(security.Symbol, 50, Resolution.Hour)
history = self.History([security.Symbol], 50, Resolution.Hour)
for time, row in history.loc[security.Symbol].iterrows():
self.Small.Update(time, row["close"])
In a backtest of the last five years, the algorithm works perfectly and is correctly using the historical data and making trades for the first four years. However, on the July 1st bar in 2019, I get an error message saying, "Object is not callable at OnSecuritiesChanged" and the algorithm stops running (it also says the error is on line 94 even though my entire code has only 83 lines, but that's likely unrelated to the issue). I am sure this error comes from the time and row loop because this algorithm was backtesting just fine before I added these lines in.
What is the problem and how do I solve it?
Michael Manus
very good algo.
thx for posting as every algo has a value to learn something.
Warren Harding
you meant https://www.youtube.com/watch?v=KfLVs3yv_wg
hehe the lyrics fit quite well
also for bad days:
https://www.youtube.com/watch?v=nqiVvOXotyw
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!