---
title: macd (MACD)
description: "macd API reference: parameters, response fields and example requests."
---

# `macd` — MACD

> Category: **Momentum** · Standard

::: tip Reading the response
Use `POST /api/indicators?explain=true` to include interpretation notes at `indicators[responseKey].explain`. Read numeric results from `columns` and `data` in the same object.
:::

This is a momentum indicator.

## Parameters

| Parameter | Type | Default |
|------|------|--------|
| `fast` | int | `12` |
| `slow` | int | `26` |
| `signal` | int | `9` |

## Output columns

| Column |
|------|
| `hist` |
| `macd` |
| `signal` |



## Native features

Set top-level `signals: true` and read `indicators[responseKey].signals`. By default features are evaluated on closed bars: `true` is a positive result, `false` a valid negative result, and `null` unknown. These are not trade instructions.

This indicator supports `include_forming: true`: treat the current final OHLCV sample as complete under the same native rules, returning one set of values, features and objects. The signal table appends `bar_status`: `closed` for closed bars, `forming` for a trial with `confirmed_at_ms=null`. A trial may disappear on later updates or at close. For BYO, still set `last_bar_closed: false`. Close requirements below describe the default mode; trials only admit the final sample without shortening structural windows or model confirmation requirements. See [forming trials](/signals#forming).

History lengths are minimum evaluation requirements, not convergence guarantees. Comparisons use unrounded values and the exact boundaries below. Do not turn `null` into `false` on gaps, invalid dependencies or forming bars in the default mode.

| Feature column | Kind | Rule | Meaning | History / validity |
| --- | --- | --- | --- | --- |
| `macd.cross_up` | `event` | Previous MACD <= Signal; current MACD > Signal. | MACD's momentum relationship to its signal line or zero; crossings are events, relative positions are states, not trade instructions. | max(fast, slow) + signal contiguous bars with valid dependencies. |
| `macd.cross_down` | `event` | Previous MACD >= Signal; current MACD < Signal. | MACD's momentum relationship to its signal line or zero; crossings are events, relative positions are states, not trade instructions. | max(fast, slow) + signal contiguous bars with valid dependencies. |
| `macd.zero_cross_up` | `event` | Previous MACD <= 0; current MACD > 0. | MACD's momentum relationship to its signal line or zero; crossings are events, relative positions are states, not trade instructions. | max(fast, slow) + signal contiguous bars with valid dependencies. |
| `macd.zero_cross_down` | `event` | Previous MACD >= 0; current MACD < 0. | MACD's momentum relationship to its signal line or zero; crossings are events, relative positions are states, not trade instructions. | max(fast, slow) + signal contiguous bars with valid dependencies. |
| `macd.above_signal` | `state` | Current MACD > Signal. | MACD's momentum relationship to its signal line or zero; crossings are events, relative positions are states, not trade instructions. | max(fast, slow) + signal - 1 contiguous bars with valid dependencies. |
| `macd.below_signal` | `state` | Current MACD < Signal. | MACD's momentum relationship to its signal line or zero; crossings are events, relative positions are states, not trade instructions. | max(fast, slow) + signal - 1 contiguous bars with valid dependencies. |

### `macd.zero_cross_up`

- Zero crossings refer to the MACD line, not the histogram.

### `macd.zero_cross_down`

- Zero crossings refer to the MACD line, not the histogram.

See [feature requests](/compute#native-features) for the format and examples. `/api/chart` also accepts `signals: true`, marking confirmed events by default. With `include_forming`, trial events also produce markers tagged `bar_status=forming`; states are not drawn on every bar. See [feature charts](/compute#feature-chart).

## Example call

```bash
curl -X POST -H "Authorization: Bearer mq_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "exchange": "binance",
    "market":   "perp",
    "symbol":   "BTCUSDT",
    "interval": "5m",
    "limit":    100,
    "signals":  true,
    "calc":     [{"name": "macd", "params": {"fast": 12, "slow": 26, "signal": 9}}]
  }' \
  https://api.mobiusquant.ai/api/indicators
```

## Full interpretation guide

Field meanings, interpretation rules and usage notes are
documented in Chinese at:

[macd (中文详情)](https://docs.mobiusquant.ai/zh/indicators/macd)

## Related indicators

[accelerator_oscillator](./accelerator_oscillator) · [awesome_oscillator](./awesome_oscillator) · [cci](./cci) · [chande_mo](./chande_mo) · [connors_rsi](./connors_rsi) · [coppock_curve](./coppock_curve) · [dpo](./dpo) · [kst](./kst)
