GET/indicator/macd

Moving Average Convergence Divergence (MACD)

Category: Momentum · Updated November 2026


The TAAPI.IO MACD API returns the Moving Average Convergence Divergence line, signal line and histogram as JSON for crypto pairs and US stocks. Send an exchange, symbol and timeframe to get real-time or historical MACD values, with no candles to download and no calculations to maintain.

What one request returns

  • The three MACD values: the MACD line (valueMACD), its signal line (valueMACDSignal) and the gap between them (valueMACDHist). The histogram's sign tells you which line is on top, so a change of sign is a crossover.
  • A series, with results: one value per candle, oldest first, to spot a crossover between the last two closed candles or to backtest.
  • Several timeframes at once, with /bulk: for example a 4-hour MACD for the signal and a daily MACD for the trend, in one request.

So one call answers two questions: which way is momentum pointing, and did it just turn?

Example: a 4-hour crossover against the daily trend, 11 November 2026

Request: one /bulk call for BTCUSDT on Binance, with MACD on 4-hour candles (results=3, backtrack=1, so the last three closed candles) and on daily candles (backtrack=1, so yesterday). Sent at 16:40 UTC with the default 12, 26, 9 settings.

CandleMACDSignalHistogramReading
4h, 11 Nov 04:00−699.27−678.71−20.56MACD still below its signal line
4h, 11 Nov 08:00−670.86−677.14+6.28Bullish crossover: the histogram turned positive
4h, 11 Nov 12:00−640.99−669.91+28.92The gap is widening
1d, 10 Nov−1,799.33−1,416.71−382.62Below its signal line and below zero: downtrend

How to interpret this: The 4-hour chart just gave the textbook buy signal. The histogram turned positive on the 08:00 candle and grew on the next one. The daily chart disagrees. Its MACD has been below the signal line since 29 September, when BTC closed at 83,664, and below zero since late October. BTC is down about 11% since then. In that trend, the same 4-hour signal had already fired six times in two weeks: 26 and 29 October, and 1, 3, 8 and 9 November. Each one ended lower by the next bearish crossover, by between 0.7% and 4.6%. The worst was 29 October, when BTC went from 81,778 to 77,992 in eight hours. All six, like today's, came with the MACD line below zero. So a trend-following bot would read today's crossover as a bounce, not a new uptrend. It would wait until the daily histogram turns positive, or the 4-hour MACD climbs above zero, before buying.

BTCUSDT 4-hour candles and MACD, 26 October to 11 November 2026 BTC fell from about 81,000 to 73,000. The 4-hour MACD crossed above its signal line seven times, always below zero. The first six bullish crossovers ended lower by the next bearish crossover. The daily MACD stayed below its signal line the whole time. 74k 76k 78k 80k 82k -1000 -500 0 500 MACD 12, 26, 9 (4h) 26 Oct 29 Oct 1 Nov 4 Nov 7 Nov 10 Nov Each ▲ before 11 Nov closed lower by the next ▼ (6 of 6) Daily MACD below its signal line the whole time 11 Nov 08:00: 7th bullish cross, MACD still below zero MACD line Signal line Histogram zero line Bullish cross Bearish cross BTCUSDT · Binance 4h candles · 26 Oct – 11 Nov 2026 (closed candles)
Top: 4-hour candles, with green triangles at bullish crossovers and red triangles at bearish ones. Bottom: the MACD line (blue), signal line (amber) and histogram. Every bullish crossover in this period came with the MACD line below zero.

Values are from the production API on 11 November 2026. Crossovers are counted on closed 4-hour candles from 26 October. Six signals are an illustration, not a backtest, and nothing here is financial advice.

SpecValue
EndpointGET https://v2.taapi.io/indicator/macd
OutputsMACD line, signal line, histogram, timestamp
Default settings12, 26, 9
MarketsBinance, Binance Futures, Bybit, Gate.io, Kraken and US stocks
Timeframes1m to 1w
DeliveryREST, bulk and WebSocket

Get MACD values with one API call

This request returns the current MACD for BTCUSDT on 1-hour Binance candles. Add your API key to run it here.

curl -G https://v2.taapi.io/indicator/macd \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "exchange=binance" \
  --data-urlencode "symbol=BTCUSDT" \
  --data-urlencode "timeframe=1h"

MACD API response

Every value is returned in an array, even for a single candle. This response came from the live API on 9 November 2026.

200 OK
{
  "valueMACD": [-404.3589597536193],
  "valueMACDSignal": [-335.59180677260025],
  "valueMACDHist": [-68.76715298101902],
  "timestamp": [1794218400]
}
FieldTypeDescription
valueMACDnumber[]MACD line: fast EMA minus slow EMA
valueMACDSignalnumber[]Signal line: EMA of the MACD line
valueMACDHistnumber[]Histogram: MACD line minus signal line
timestampinteger[]Unix time of each candle, in seconds

MACD API parameters

NameTypeRequiredDefaultDescription
exchangestringYes—binance, binancefutures, bybit, gateio, kraken or stocks
symbolstringYes—Pair or ticker, e.g. BTCUSDT or AAPL
timeframestringYes—1m 5m 15m 1h 4h 1d 1w
fastPeriodintegerNo12Fast EMA period
slowPeriodintegerNo26Slow EMA period
signalPeriodintegerNo9Signal line period
resultsintegerNo1Number of values to return, or max
backtrackintegerNo0Candles to skip from the most recent

What is MACD?

MACD (Moving Average Convergence Divergence) is a trend-following momentum indicator developed by Gerald Appel. It compares two exponential moving averages to show the direction of a trend and whether momentum is building or fading.

MACD formula

OutputCalculation
MACD line12-period EMA − 26-period EMA
Signal line9-period EMA of the MACD line
HistogramMACD line − signal line

In the response above, −404.36 minus −335.59 gives the histogram value of −68.77. A negative histogram means the MACD line is below its signal line.

How to read MACD in your code

SignalMeaningCondition
Bullish crossoverMomentum turning upvalueMACDHist moves from ≤ 0 to > 0
Bearish crossoverMomentum turning downvalueMACDHist moves from ≥ 0 to < 0
Above zeroFast EMA is above slow EMAvalueMACD > 0
Below zeroFast EMA is below slow EMAvalueMACD < 0
Momentum fadingTrend is losing strengthAbsolute histogram value shrinking

A divergence appears when price makes a new high but MACD makes a lower high, or the reverse at lows. It can warn of a reversal, but it needs a series of values to detect, so request them with results.

Limitations: MACD is built from moving averages, so it lags price and can produce repeated false crossovers in sideways markets. Many traders confirm it with a trend or volume filter. Nothing on this page is financial advice.

Detect a MACD crossover with Python

The newest value belongs to the candle still forming and can change until it closes. To avoid acting on a signal that disappears, use backtrack=1 and compare the last two closed candles. Arrays run oldest first.

curl -G https://v2.taapi.io/indicator/macd \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "exchange=binance" \
  --data-urlencode "symbol=BTCUSDT" \
  --data-urlencode "timeframe=1h" \
  --data-urlencode "results=2" \
  --data-urlencode "backtrack=1"

Filter crossovers with a higher timeframe

Crossovers on short timeframes fire often, and in a trend most of the ones against it fail, as in the example above. A common fix is to take a signal only when a higher timeframe agrees: a 4-hour crossover with the daily histogram on the same side of zero, or a 15-minute crossover with the 1-hour histogram. One /bulk request returns both. Two constructs need the Pro plan or above. On Basic, make two GET requests instead.

POST/bulk
curl -X POST https://v2.taapi.io/bulk \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "constructs": [
    {
      "id": "btc_4h",
      "exchange": "binance",
      "symbol": "BTCUSDT",
      "timeframe": "4h",
      "indicators": [
        {
          "id": "macd",
          "indicator": "macd",
          "results": 2,
          "backtrack": 1
        }
      ]
    },
    {
      "id": "btc_1d",
      "exchange": "binance",
      "symbol": "BTCUSDT",
      "timeframe": "1d",
      "indicators": [
        {
          "id": "macd",
          "indicator": "macd",
          "backtrack": 1
        }
      ]
    }
  ]
}'

The response at 16:40 UTC on 11 November. Both 4-hour histogram values are already positive, because the crossover happened one candle earlier, between the 04:00 candle (−20.56) and the 08:00 candle (+6.28). So this response prints No crossover. Run at 12:05 UTC, when 08:00 was the last closed candle, the same script printed Bullish 4h crossover against the daily trend: skip. Run it once per closed candle so you don't miss one.

200 OK
{
  "btc_4h": {
    "macd": {
      "valueMACD": [-670.8607757510617, -640.9926914345997],
      "valueMACDSignal": [-677.1391784198927, -669.909881022834],
      "valueMACDHist": [6.2784026688309496, 28.91718958823435],
      "timestamp": [1794384000, 1794398400]
    }
  },
  "btc_1d": {
    "macd": {
      "valueMACD": [-1799.3266097731102],
      "valueMACDSignal": [-1416.7087529977862],
      "valueMACDHist": [-382.61785677532407],
      "timestamp": [1794268800]
    }
  }
}

Other common filters: take bullish crossovers only above the zero line (valueMACD > 0), require the histogram to grow for two candles in a row, or check the trend with a 200-period EMA.

Get historical MACD values

Add results to return a series for backtesting or charting. The last element is the most recent candle.

curl -G https://v2.taapi.io/indicator/macd \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "exchange=binance" \
  --data-urlencode "symbol=BTCUSDT" \
  --data-urlencode "timeframe=4h" \
  --data-urlencode "results=100"

Get MACD for multiple symbols

Use bulk to combine symbols, timeframes and MACD settings in one request. Each exchange, symbol and timeframe combination is one construct: Basic allows 1 per request, Pro 3 and Expert 10.

POST/bulk
curl -X POST https://v2.taapi.io/bulk \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "constructs": [{
    "id": "btc_1h",
    "exchange": "binance",
    "symbol": "BTCUSDT",
    "timeframe": "1h",
    "indicators": [
      { "id": "macd", "indicator": "macd" },
      { "id": "macd_fast", "indicator": "macd", "fastPeriod": 8, "slowPeriod": 21, "signalPeriod": 5 }
    ]
  }]
}'

Stream MACD in real time

Subscribe over WebSocket to receive new values every 5 seconds while the candle is forming. Streaming supports 1m, 5m, 15m and 1h, and uses interval where REST uses timeframe.

WSSwss://v2.taapi.io/streaming
{
  "type": "subscribe",
  "id": "btc-macd",
  "exchange": "binance",
  "symbol": "BTCUSDT",
  "interval": "1m",
  "indicator": "macd",
  "params": { "fastPeriod": 12, "slowPeriod": 26, "signalPeriod": 9 }
}

Common MACD settings

These are starting points, not recommendations. Test any setting on your own market and timeframe.

SettingsCharacterTypical use
12, 26, 9StandardDefault for most timeframes
8, 21, 5Faster, more signalsShort intraday charts
5, 35, 5Wider EMA gapClearer trend separation

Why MACD values can differ between platforms

  • Data source: each exchange has its own candles, so a Binance MACD will differ from a Coinbase chart.
  • Open candle: a forming candle changes the latest value on every update.
  • Calculation history: EMAs depend on how much earlier data they start from.
  • Signal type: some platforms, including MetaTrader's default MACD, use an SMA for the signal line. TAAPI.IO's macd uses an EMA for the signal line, as Gerald Appel defined it.

API status codes

{
  "valueMACD": [142.83],
  "valueMACDSignal": [98.21],
  "valueMACDHist": [44.62],
  "timestamp": [1718233200]
}

MACD API FAQ

What does the MACD API return?

Three arrays, valueMACD, valueMACDSignal and valueMACDHist, plus a timestamp for each candle.

Is the latest MACD value final?

No. The newest value belongs to the candle still forming and changes until it closes. Add backtrack=1 to read the last closed candle.

How do I avoid false MACD crossovers?

Take a crossover only when a higher timeframe agrees, for example a 4-hour crossover with the daily valueMACDHist on the same side of zero. Use backtrack=1 so you act on closed candles only. See Filter crossovers with a higher timeframe.

Can I change the MACD periods?

Yes. Set fastPeriod, slowPeriod and signalPeriod. The defaults are 12, 26 and 9.

Can I get MACD for stocks as well as crypto?

Yes. Use exchange=stocks with a ticker such as AAPL. US stocks are included on the Pro plan and above.

Can I get MACD for many symbols at once?

Yes. POST /bulk accepts several symbols and timeframes in one request, up to your plan's construct limit.

Build with MACD on Binance, Bybit or US stocks. Start for free or browse all 262 indicators.