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)

Clone Algorithm
3
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 5765732f780acf0f8ce65af5
There was a runtime error.
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.