Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Trying to pass data.history to talib.macd, is that wrong?

My end goal is to detect the bottom peak's of an MACD's histogram.

As you can see I'm passing data.history(stock,'price',27,1m) to macd.
But this returns nulls when printed.

I've scanned the examples and not sure what I'm doing wrong. I'm fairly new to Python.

also, is the "hist" variable returned the histogram? so I could detect a peak by determining if (hist[-1]> hist[-2] AND hist[-3]>hist[-2] AND hist[-2]<0)

1 response

The amount of historical days you are passing in is incorrect. MACD needs at least 33 or 35 days of history to work I can't remember, just keep increasing the historical values until you get a value for the last input of the array.