Who can help me with the ATR portion of this function? It always returns null values. Is it because talib requires minute or daily bars?
def createTimeBarRange(stock,interval,lookback):
# call by barPrices = createTimeBarRange(stock,5,10)
# get values, e.g. barPrices['high'][-1] for latest bar high
# or barPrices['high'][-2] for previous bar high etc.
# create a bar of that combines minutes into slices defined by interval
expanded= (interval + lookback )
timeslice= str(interval)+ "min"
#need to ignore the present value in our results so add 1 to lookback and then filter results
open_price = history(expanded+1, '1m', 'open_price').dropna(axis=1)[:-1]
open_price= open_price.resample(timeslice, how='first').dropna()
high = history(expanded+1, '1m', 'high').dropna(axis=1)[:-1]
high= high.resample(timeslice, how='max').dropna()
low = history(expanded+1, '1m', 'low').dropna(axis=1)[:-1]
low= low.resample(timeslice, how='min').dropna()
close_price = history(expanded+1, '1m', 'close_price').dropna(axis=1)[:-1]
close_price= close_price.resample(timeslice, how='last').dropna()
barAtr = talib.ATR( high [stock], low[stock], close_price[stock], timeperiod=lookback)
dict = { "open_price" : open_price[stock], "high":high[stock] , "low": low[stock] , "close_price" : close_price[stock], "barAtr": barAtr}
return dict