Skip to content

MACD output not same between TA-Lib and Binance #659

Closed

Description

@albertZhuo420

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.

input.csv
macd_ta.py.txt

Activity

  1. mario4tier commented on Jul 22, 2026

    @mario4tier
    Member

    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.

  2. changed the title [-]The data of MACD calculated by TA_MACDEXT is wrong.[/-] [+]MACD output not same between TA-Lib and Binance[/+] on Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions