Moving Average Convergence Divergence (MACD)

Moving average convergence divergence (MACD) is a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price. The MACD is calculated by subtracting the 26-period exponential moving average (EMA) from the 12-period EMA.

Get started with the macd

Simply make an HTTPS [GET] request or call in your browser:


The macd endpoint returns a JSON response like this:

  "valueMACD": 737.4052287912818,
  "valueMACDSignal": 691.8373005221695,
  "valueMACDHist": 45.56792826911237
Example response from TAAPI.IO when querying macd endpoint.

API parameters

Required String
The secret which is emailed to you when you request an API key.
Required String
The exchange you want to calculate the indicator from: binance or bitstamp. More exchanges supported natively are coming soon. For other crypto / stock exchanges, please refer to our Client or Manual integration methods.
Required String
Symbol names are always uppercase, with the coin separated by a forward slash and the market: COIN/MARKET. For example: BTC/USDT Bitcoin to Tether, or LTC/BTC Litecoin to Bitcoin...
Required String
Interval or time frame: We support the following time frames: 1m, 5m, 15m, 30m, 1h, 2h, 4h, 12h, 1d, 1w. So if you're interested in values on hourly candles, use interval=1h, for daily values use interval=1d, etc.
Optional Integer
The backtrack parameter removes candles from the data set and calculates the macd value X amount of candles back. So, if you’re fetching the macd on the hourly and you want to know what the macd was 5 hours ago, set backtrack=5. The default is 0 and a maximum is 50.
Optional Integer
The backtracks parameter returns the macd value calculated on every candle for the past X candles. For example, if you want to know what the macd was every hour for the past 12 hours, you use backtracks=12. As a result, you will get 12 values back.
Optional String
The chart parameter accepts one of two values: candles or heikinashi. candles is the default, but if you set this to heikinashi, the indicator values will be calculated using Heikin Ashi candles. Note: Pro & Expert Plans only.
Optional Integer

Fast period length

Default: 12

Optional Integer

Slow period length

Default: 26

Optional Integer

Signal smoothing

Default: 9

More examples

Let's say you want to know the macd value on the last closed candle on the 30m timeframe. You are not interest in the real-time value, so you use the backtrack=1 optional parameter to go back 1 candle in history to the last closed candle.

Get macd values on each of the past X candles in one call

Let's say you want to know what the macd daily value was each day for the previous 10 days. You can get this returned by our API easily and efficiently in one call using the backtracks=10 parameter:


Here's the example response:

    "valueMACD": 979.518807843051,
    "valueMACDSignal": 893.54139321284,
    "valueMACDHist": 85.977414630211,
    "backtrack": 0
    "valueMACD": 949.7317001653792,
    "valueMACDSignal": 872.0470395552873,
    "valueMACDHist": 77.6846606100919,
    "backtrack": 1
    "valueMACD": 890.0052943634655,
    "valueMACDSignal": 852.6258744027642,
    "valueMACDHist": 37.379419960701284,
    "backtrack": 2
    "valueMACD": 861.9048230401022,
    "valueMACDSignal": 843.2810194125889,
    "valueMACDHist": 18.623803627513325,
    "backtrack": 3
    "valueMACD": 886.7801513067898,
    "valueMACDSignal": 838.6250685057105,
    "valueMACDHist": 48.15508280107929,
    "backtrack": 4
    "valueMACD": 894.6453135481788,
    "valueMACDSignal": 826.5862978054407,
    "valueMACDHist": 68.0590157427381,
    "backtrack": 5
    "valueMACD": 879.2991706119356,
    "valueMACDSignal": 809.5715438697562,
    "valueMACDHist": 69.72762674217938,
    "backtrack": 6
    "valueMACD": 902.8467602371384,
    "valueMACDSignal": 792.1396371842113,
    "valueMACDHist": 110.70712305292705,
    "backtrack": 7
    "valueMACD": 875.7944581189513,
    "valueMACDSignal": 764.4628564209795,
    "valueMACDHist": 111.33160169797179,
    "backtrack": 8
    "valueMACD": 846.0061822063726,
    "valueMACDSignal": 736.6299559964866,
    "valueMACDHist": 109.376226209886,
    "backtrack": 9

Looking for even more integration examples in different languages like NodeJS, PHP, Python, Curl or Ruby? Continue to [GET] REST - Direct documentation.