Hello, so I'm pretty new here but so far I like what I see quite a bit, however I'm having trouble figuring out how the framework works.

I'm currently trying to implement a rotational etf strategy, however I keep getting this erro that I have no idea how to deal with:

Runtime Error: TypeError : Cannot get managed object
at OnData in main.py:line 34
TypeError : Cannot get managed object

I simply have no idea what this means. What is the managed object in question?
What's really strange is that even when I change my code around to simply add spaces around line 34, it still tells me that the error is on line 34 even if line 34 is blank.

Here is my code so far. Any help would be greatly appreciated.Thanks in advance!

import numpy as np


class RegionalETFrotationAlgorithm(QCAlgorithm):


def Initialize(self):


self.SetStartDate(2013,10, 7) #Set Start Date
self.SetEndDate(2013,10,11) #Set End Date
self.SetCash(100000) #Set Strategy Cash
# Find more symbols here: http://quantconnect.com/data
self.tickers = ["MDY", "IEV", "EEM", "ILF", "EPP"]
self.AddEquity("EDV", Resolution.Daily)
self.AddEquity("SPY", Resolution.Daily)
self.growth = []
for ticker in self.tickers:
self.AddEquity(ticker, Resolution.Daily)
dictionary = {"symbol":ticker, "momentum":self.MOMP(ticker,90, Resolution.Daily) }
self.growth.append(dictionary)



def OnData(self, data):


for ticker in self.tickers:
self.AddEquity(ticker)
dictionary = {"symbol":ticker, "momentum":self.MOMP(ticker,90, Resolution.Daily) }
self.growth.append(dictionary)

bestEtf = self.bestEtf()
if bestEtf['momentum'] > 0:
if self.Portfolio.Invested:
Liquidate()
self.SetHoldings(bestEtf['symbol'], 1)
else:
if self.Portfolio.Invested:
Liquidate()
self.SetHoldings("EDV", 1)




def bestEtf(self):
current = self.growth

while len(current)>1:
if current[0]['momentum'] >= current[1]['momentum']:
del current[1]
else:
del current[0]
return current[0]