Hello everyone,
I am actually finding it difficult to like compare the Kijun value with a quote bar (OHLC) value. It seems Ichimoku components are other type than float.
class Crossing(QCAlgorithm):
'''Basic template algorithm simply initializes the date range and cash'''
def Initialize(self):
'''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
self.SetTimeZone("Africa/Douala")
self.SetStartDate(2018,4, 1) #Set Start Date
self.SetEndDate(2019,6, 3) #Set End Date
self.SetCash(1000) #Set Strategy Cash
self.ProfitTarget = None
self.StopLoss = None
# Find more symbols here: http://quantconnect.com/data
self.AddForex("EURUSD", Resolution.Daily)
self.window = RollingWindow[QuoteBar](2)
self.ichi = self.ICHIMOKU("EURUSD", 9, 26, 26, 52, 26, 26, Resolution.Daily)
self.ichi.Updated += self.ichiUpdated
self.ichiWin = RollingWindow[IndicatorDataPoint](2)
def ichiUpdated(self, sender, updated):
'''Adds updated values to rolling window'''
self.ichiWin.Add(updated)
def OnData(self, data):
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
Arguments:
data: Slice object keyed by symbol containing the stock data
'''
if data.ContainsKey("EURUSD"):
self.window.Add(data["EURUSD"])
# Wait for windows to be ready.
if not (self.window.IsReady and self.ichi.IsReady): return
currBar = self.window[0]
prev1 = self.window[1]
self.Debug(self.ichi.Kijun > prev1.Open)
self.Debug(self.ichi.Kijun > prev1.Open)
is generating
Runtime Error: TypeError : Cannot get managed object
at OnData in main.py:line 63
TypeError : Cannot get managed object (Open Stacktrace)
Thanks for your help.
Douglas Stridsberg
Hi,
As with all indicators, you need to access the .Current.Value property of the indicator in question.
In your case, that would be self.ichi.Kijun.Current.Value.
The reason is that each part of the indicator is an indicator in and of itself, containing information about the symbol, name, timeframe, etc.
Nkondog Venceslas
Nkondog Venceslas
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!