I'm working on a universe/Strategy combination. I'm using volume levels in the universe selection, but I am also using a strategy to select which symbols will be included daily. There is then supposed to be a sec, min, and hour strategy frame that are traded on more or less seperatly, with some values from the frame higher being included in some logic.

My current code builds without issue, but throws this error on compile time. "If using all scalar values, you must pass an index" seems like it's my main small issue:

Algorithm.Initialize() Error: During the algorithm initialization, the following exception has occurred: Loader.TryCreatePythonAlgorithm(): Unable to import python module ./cache/algorithm/main.pyc. AlgorithmPythonWrapper(): ValueError : If using all scalar values, you must pass an index
  at __init__ in main.py:line 632
 ValueError : If using all scalar values, you must pass an index Stack Trace: QuantConnect.Lean.Engine.Setup.AlgorithmSetupException: During the algorithm initialization, the following exception has occurred: Loader.TryCreatePythonAlgorithm(): Unable to import python module ./cache/algorithm/main.pyc. AlgorithmPythonWrapper(): ValueError : If using all scalar values, you must pass an index
  at __init__ in main.py:line 632
 ValueError : If using all scalar values, you must pass an index at QuantConnect.Lean.Engine.Setup.BacktestingSetupHandler.CreateAlgorithmInstance (QuantConnect.Packets.AlgorithmNodePacket algorithmNodePacket, System.String assemblyPath) [0x0006c] in :0 
  at QuantConnect.Lean.Engine.Engine.Run (QuantConnect.Packets.AlgorithmNodePacket job, QuantConnect.Lean.Engine.AlgorithmManager manager, System.String assemblyPath) [0x0015d] in :0 

 

I can include more code, but there is a lot. Below is an example of the hour class init, which is where my error says the code triggers. when called it is 

Hour.Initialize(symbol,frame)

 I understand that I can restructure to the reccommended framework and inits, but I would also like to see if there is a solution to this, cause I feel like there's potential to play with it. 

Many thanks.

class Hour(QCAlgorithm): def __init__(self): self.params = pd.DataFrame({'is_up': False,'is_down': False, ' trade': False,'tolerance':1.01, 'strength': 0}) self.data = pd.DatFrame({'open':[], 'high':[], 'low':[], 'close':[], 'volume':[], 'closeTime':[]}) self.trades = pd.DataFrame({'long':[], 'short':[]}) def Initialize(self, symbol, frame): self.symbol = symbol self.inds = {'ALMA':{'fast':ALMA(symbol, 20, 6, .15), 'slow':ALMA(symbol, 100, 6, .85), 'alma':inds['ALMA']['fast'] - ( inds['ALMA']['slow'] * self.params['tolerance'])}, 'ATR':{'AATR':ATR( symgbol, period = 20, type = Alma), 'EATR':ATR( symgbol, period = 20, type = Exponential), 'atr':( inds['ATR']['AATR'] + inds['ATR']['EART']) /2}, 'AROON':AROON(symbol, 50), 'ADOSC':ADOSC(symbol, 100, 200)}

 

Author