Hi - I am new to QuantConnect, and I am trying to calculate the Simple Moving Average of a stock in the last 1 hour period, however constantly get 0.0 when I set the period to 60 and the resolution to Minute. Am I missing something here?

Any help would be greatly appreciated for this newbie!




import numpy as np
import pandas as pd

### <summary>
### Basic template algorithm simply initializes the date range and cash. This is a skeleton
### framework you can use for designing an algorithm.
### </summary>

class MyAlgo(QCAlgorithm):
def Initialize(self):
# Reference to AAPL
self.secs = ["AAPL", "IBM", "CAT"]
for stock in self.secs:
self.stock = self.AddEquity(stock)
self.secs_df = pd.DataFrame(index=self.secs)

def OnData(self, data):
''' Runs every tick defined by resolution in initialize under equity'''
# Position 100% of our portfolio to be long in AAPL
len_sec = len(self.secs_df)
self.Log("total securities to trade " + str(len_sec))
for stock in self.secs_df.index:
self.SetHoldings(stock, 1.0/len_sec)
#self.SetHoldings("IBM", 0.5)
shares_held = self.Portfolio[stock].AbsoluteQuantity
self.BuyPrice = self.Portfolio[stock].AveragePrice
self.sma = self.SMA(stock, 60, Resolution.Minute)
self.Log(str(stock) + ' ' + str(shares_held) + ' ' + str(self.BuyPrice) + ' SMA: ' + str(self.sma))