You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MACD output not same between TA-Lib and Binance #659
I used Binance's BOMEUSTD daily data to verify the MACD, the function I used was TA_MACD, the final result was inconsistent with Binance's data, then this function is based on the MA, so I dared to use TA_MACDEXT, and set TA_MAType_EMA, the final result is the same as TA TA_MACDEXT, and set TA_MAType_EMA, the result is the same as TA_MACD.
I switched to ta-lib-python, and the results are the same!!!!
I provide the python code, and the BOME k-line data.
The OS i used is Ubnutu22.04. use pip to install TA_LIB.
MACD in TA-Lib is correct — it matches the original MACD as defined by its author, Gerald Appel, which uses an EMA for the smoothing.
Because MACD is EMA-based by definition, it is expected that MACDEXT(EMA, EMA, EMA) gives the same result as MACD. That's not a bug. The purpose of MACDEXT is to let you experiment with other smoothing methods.
I don't have access to Binance's implementation, so I can't say exactly how they compute it.
A possible reason for a difference is the seed used to start the recursion. Although the smoothing is EMA, TA-Lib EMA is seeded with an SMA of the first N values. This is the mainstream algo, but not the only valid way.
Some implementations (e.g MetaStock) choose to seed with EMA starting at the first bar (so both seed and smoothing is EMA). The seed mainly affects the early "warm-up" bars, and the difference fades as more data is processed.
Without the data from Binance, or access to their algo, it will be difficult to explain the difference.
Activity
mario4tier commentedon Jul 22, 2026
MACD in TA-Lib is correct — it matches the original MACD as defined by its author, Gerald Appel, which uses an EMA for the smoothing.
Because MACD is EMA-based by definition, it is expected that MACDEXT(EMA, EMA, EMA) gives the same result as MACD. That's not a bug. The purpose of MACDEXT is to let you experiment with other smoothing methods.
I don't have access to Binance's implementation, so I can't say exactly how they compute it.
A possible reason for a difference is the seed used to start the recursion. Although the smoothing is EMA, TA-Lib EMA is seeded with an SMA of the first N values. This is the mainstream algo, but not the only valid way.
Some implementations (e.g MetaStock) choose to seed with EMA starting at the first bar (so both seed and smoothing is EMA). The seed mainly affects the early "warm-up" bars, and the difference fades as more data is processed.
Without the data from Binance, or access to their algo, it will be difficult to explain the difference.
[-]The data of MACD calculated by TA_MACDEXT is wrong.[/-][+]MACD output not same between TA-Lib and Binance[/+]