Back

Help Using Candlestick Indicators

I've only been using QuantConnect for a few weeks and assume this is pretty basic, but I can't seem to get candle stick indicators to work. My code is just the following, but when backtesting I get the error: "Runtime Error: TypeError : Cannot get managed object at OnData in main.py:line 52 TypeError : Cannot get managed object". Also, I don't understand why the it says the error is in line 52, as my code is only 10 lines. Thank you!

class TachyonVerticalCompensator(QCAlgorithm):

def Initialize(self):
self.SetStartDate(2018, 12, 29)
self.SetCash(2000)
self.AddEquity("NUGT", Resolution.Hour)
self.tls = self.CandlestickPatterns.ThreeLineStrike("NUGT")

def OnData(self, data):
if self.tls > 0: self.Debug(self.tls)

 

Update Backtest







0

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.


Realized I should've been using self.tls.Current.Value! Still not sure about the error in line 52 though...

0

Hi Justin,

self.tls is a ThreeLineStrike class, not an integer. I believe you are looking for self.tls.Current.Value instead. For more information regarding ThreeLineStrike class, you might want to read this documentation page.

Hope it helps!

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed