accessibility of daily moving average data

I have created a daily moving average variable. But I could not get the current moving average data when the period is day. I am able to get yesterday moving average. Here is below for the code.

def on_start(self, md, order, service, account):
daily_bars = ###moving average 0 for simple, 1 for ema
dclose = daily_bars.close
self.realSMA21 = talib.MA(dclose , timeperiod=21, matype=0)
self.realSMA50 = talib.MA(dclose , timeperiod=50, matype=0)
I can get access to self.realSMA21[-1] (yesterday MA) but self.realSMA21[0] gives NAN so how to get access to today(or the most current) MA data?


Sign In or Register to comment.