this has been bugging me since the morning. I searched for a solution, but other people mostly had similar problems because of different initial EMAs.
Here, I am using an array of 100 numbers for testing. I calculated emas by hand and with talib also (It is using SMA for the inital EMA). That part is correct. But, when I do ema12-ema26 by hand and calculate it with MACD function, the function is completely wrong. I tried using SMAs, but the result is still wrong... I'm looking at the MACD Line output ofcourse.
For the EMAs I'm calling the EMA functions (timeperiods 12 and 26)), and for MACD I'm using 26 12 9.
Has anyone had this problem before?
EDIT: I tried it on a 1000 number example and it seems that the MACD function value is converging towards the calculated value. I guess talib.MACD is not using the talib.EMA for the calculation of EMAs and that's why I have different results...