Moving Average Convergence Divergence (MACD)

Get the MACD indicator history of a futures trading pair on an exchange, including the MACD line (DIF), the signal line and the histogram, with customizable fast line, slow line and signal line periods. Useful for judging trend strength and identifying golden crosses and death crosses.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Available on these API plans: Startup Standard Professional Enterprise

Update frequencyReal-time

Response Data

data is an array; each element is one interval, and time is the start time of the interval. Values are calculated from the trading pair's price candles: macd_value is the fast EMA minus the slow EMA (DIF), signal is the EMA of macd_value (the signal line), and histogram equals macd_value − signal. All three values are in the trading pair's quote currency, e.g., USDT for BTCUSDT.

📘

The first records are incomplete

macd_value is returned starting from the slow_window-th candle (the 26th by default); signal and histogram start another signal_window − 1 records later (8 records by default), and records before that contain only time and macd_value. With the default parameters, requesting 60 1-hour candles returns 35 records, of which only the last 27 have signal and histogram. If you need N complete records, add slow_window + signal_window − 2 candles to limit.

📘

The histogram is not multiplied by 2

histogram equals macd_value − signal. Some charting software displays MACD bars as 2 times this difference; convert accordingly when comparing.

200 · application/json · See the response example in the right panel.

FieldTypeAlways ReturnedDescription
codestringYesBusiness status code; "0" means success
msgstringNoResult message; may be omitted on success
dataarray of objectYesArray of MACD values; each element is one interval. An empty array when there are not enough candles to start the calculation
data[].timeinteger (int64)YesInterval start time, timestamp in milliseconds (UTC); the indicator value is calculated from candles up to and including this interval
data[].macd_valuenumberYesMACD line (DIF): the fast EMA (fast_window) minus the slow EMA (slow_window); can be negative
data[].signalnumberNoSignal line (DEA): the signal_window-period EMA of macd_value; this field is not returned in the first signal_window − 1 records
data[].histogramnumberNoHistogram value, equal to macd_value − signal, not multiplied by 2; this field is not returned in the first signal_window − 1 records

API Plans

Only the API plans marked Yes in the table below can call this endpoint. For the price of each plan, see API Plans.

API PlanAccess
Hobbyist❌ No
Startup✅ Yes
Standard✅ Yes
Professional✅ Yes
Enterprise✅ Yes

Different API plans can query different lengths of history; if start_time is earlier than the range you can query, it is automatically changed to the earliest time available. For how far back each interval's history can be queried, see Intervals.

Use This Endpoint with AI

Pick a task and click Open in ChatGPT or Open in Claude: the AI reads this page first and then gives you the result. You can also click Copy and paste the full prompt into the AI tool you use.

Find golden and death crosses
Have AI write a Python function that finds golden crosses and death crosses in the 4-hour MACD of BTCUSDT.
Plot a MACD chart
Have AI write code that plots DIF, the signal line and the histogram.
Understand this endpoint
Have AI explain the three MACD values returned and the parameters in plain language.

This endpoint provides data through the REST API. Use the prompts above to have AI write the request code. For the tools available through MCP, see CoinGlass MCP.

Use Cases

ScenarioDescription
Judge Trend StrengthWhen macd_value is above the zero line and keeps increasing, the short-term and long-term moving averages are quickly moving apart and upward momentum is relatively strong; the opposite indicates relatively strong downward momentum.
Golden Cross and Death Cross Signalsmacd_value crossing above signal is a golden cross and crossing below is a death cross; these are often used as references for trend reversals and can be backtested on historical data.
Spot DivergencesWhen the price makes a new high but macd_value does not, this is called top (bearish) divergence and may signal weakening upward momentum; bottom (bullish) divergence is the opposite.
Custom Parameter ResearchAdjust fast_window, slow_window and signal_window to compare how different parameters perform on different intervals.

Related Endpoints

EndpointHow It Differs
Coin MACD ListCurrent MACD for all coins across multiple intervals; no parameters needed
Exponential Moving Average (EMA)MACD's fast and slow lines are both EMAs
Pair RSIAnother commonly used momentum indicator, ranging from 0 to 100
Pair Price OHLC HistoryPrice candles for the same trading pair, which can be aligned by time for comparison

FAQ

Why do the first few records have no signal or histogram?

The signal line applies a further signal_window-period smoothing to the existing macd_value, so it appears signal_window − 1 records later than macd_value (8 records later by default). Records before that contain only time and macd_value; check whether the fields exist when reading them.

Why are fewer records than limit returned?

The first slow_window − 1 candles (25 by default) are used only to start the calculation and are not returned. With the default parameters, requesting 60 candles returns 35 records; if there are too few candles, an empty array is returned. If you need N complete records, add slow_window + signal_window − 2 candles (33 by default) to limit.

Why is histogram different from the MACD bars in other software?

This endpoint's histogram equals macd_value − signal and is not multiplied by 2. Some charting software multiplies this difference by 2 and displays it as MACD bars; convert before comparing. Also check that the interval, parameters and price used are the same.

What are the default parameters?

fast_window=12, slow_window=26, signal_window=9, using the close price (series_type=close). You can change all of them; we recommend keeping fast_window smaller than slow_window.

Learn More: MACD Indicator

What Is MACD?

MACD (Moving Average Convergence Divergence) measures trend momentum by the difference between two EMAs of different periods: the difference is called DIF, applying another EMA to DIF gives the signal line (DEA), and the difference between the two is the histogram. This endpoint returns them as macd_value, signal and histogram respectively.

What Do MACD Golden Crosses and Death Crosses Mean?

DIF crossing above the signal line from below is called a golden cross and is often seen as a strengthening signal; crossing below it from above is called a death cross and is often seen as a weakening signal. In range-bound markets, crossovers occur frequently, and using them alone easily produces false signals; it is best to judge them together with the trend and volume.

How Can I View the MACD of All Coins at Once?

Use Coin MACD List, which returns the current MACD and signal line of all coins for multiple intervals from 5 minutes to 1 week in one call.

Query Params
string
required
Defaults to Binance

Exchange name, e.g., Binance, OKX. For the exchanges you can query, see the Supported Exchanges and Pairs endpoint.

string
required
Defaults to BTCUSDT

Trading pair symbol, e.g., BTCUSDT. Exchanges write trading pairs differently; for the pairs you can query, see the Supported Exchanges and Pairs endpoint.

string
required
Defaults to 1d

Candlestick interval; the indicator is calculated from price candles of this interval, e.g., 1d. Options: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 1w.

int32
1 to 1000
Defaults to 1000

Number of candles used in the calculation, default 1000, range 1–1000. The number of records returned may be smaller: the first stretch of candles is used only to start the indicator calculation and is not returned; see “Response Data” below. When both start_time and end_time are passed, the number of records returned is not guaranteed to correspond to limit.

int64

Start time, timestamp in milliseconds (UTC), e.g., 1790812800000 (2026-10-01 00:00 UTC). The candles used in the calculation satisfy start_time ≤ time < end_time: the start time is included and the end time is excluded. A start time that is not on an interval boundary is aligned to the next interval; if the start time is earlier than the history your API plan can query, or the range exceeds the maximum span of a single query, the start time is automatically moved later into the allowed range. If only start_time is passed, limit candles are taken forward from the start time. Because the first stretch of candles is needed to start the calculation, the first returned record is later than start_time.

int64

End time, timestamp in milliseconds (UTC), e.g., 1792022400000 (2026-10-15 00:00 UTC). The interval at the end time is not included; an end time later than the current time is treated as the current time. If both start and end times are omitted, limit candles are taken backward with the current time as the end point.

string
enum
Defaults to close

Price used in the calculation: open for the open price, high for the high price, low for the low price, close for the close price, default close. Other values are calculated as close and do not return an error.

Allowed:
integer
Defaults to 12

Number of periods of the fast EMA, default 12. A value smaller than slow_window is recommended. Pass a positive integer; the endpoint does not validate the value range, and passing 0 or a negative number may return empty data or an error.

integer
Defaults to 26

Number of periods of the slow EMA, default 26. The first returned macd_value corresponds to the slow_window-th candle. Pass a positive integer; the endpoint does not validate the value range, and passing 0 or a negative number may return empty data or an error.

integer
Defaults to 9

Number of periods of the signal line, i.e., the number of periods of the EMA smoothing applied to the MACD line, default 9. Pass a positive integer; the endpoint does not validate the value range, and passing 0 or a negative number may return empty data or an error.

Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json