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.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Available on these API plans: Startup Standard Professional Enterprise
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_valueis returned starting from theslow_window-th candle (the 26th by default);signalandhistogramstart anothersignal_window − 1records later (8 records by default), and records before that contain onlytimeandmacd_value. With the default parameters, requesting 60 1-hour candles returns 35 records, of which only the last 27 havesignalandhistogram. If you need N complete records, addslow_window + signal_window − 2candles tolimit.
The histogram is not multiplied by 2
histogramequalsmacd_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.
| Field | Type | Always Returned | Description |
|---|---|---|---|
code | string | Yes | Business status code; "0" means success |
msg | string | No | Result message; may be omitted on success |
data | array of object | Yes | Array of MACD values; each element is one interval. An empty array when there are not enough candles to start the calculation |
data[].time | integer (int64) | Yes | Interval start time, timestamp in milliseconds (UTC); the indicator value is calculated from candles up to and including this interval |
data[].macd_value | number | Yes | MACD line (DIF): the fast EMA (fast_window) minus the slow EMA (slow_window); can be negative |
data[].signal | number | No | Signal line (DEA): the signal_window-period EMA of macd_value; this field is not returned in the first signal_window − 1 records |
data[].histogram | number | No | Histogram 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 Plan | Access |
|---|---|
| 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.
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
| Scenario | Description |
|---|---|
| Judge Trend Strength | When 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 Signals | macd_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 Divergences | When 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 Research | Adjust fast_window, slow_window and signal_window to compare how different parameters perform on different intervals. |
Related Endpoints
| Endpoint | How It Differs |
|---|---|
| Coin MACD List | Current MACD for all coins across multiple intervals; no parameters needed |
| Exponential Moving Average (EMA) | MACD's fast and slow lines are both EMAs |
| Pair RSI | Another commonly used momentum indicator, ranging from 0 to 100 |
| Pair Price OHLC History | Price 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.
