Signals
MACD — Moving Average Convergence Divergence
Track trend shifts with fast/slow EMA convergence.
What it is
MACD compares fast and slow exponential moving averages and returns three values per timestamp: the MACD line, the signal line, and the histogram.
When to use it
- Looking for bullish or bearish line crossovers.
- Measuring whether momentum is accelerating or fading through the histogram.
- Confirming trend direction alongside moving averages.
The maths
MACD line = EMA(12) - EMA(26), Signal line = EMA(9) of MACD, Histogram = MACD - Signal
What it tells you
A MACD line crossing above the signal line is bullish; below is bearish. The histogram shows the speed of convergence and divergence. Divergence from price can precede trend changes.
REST example
python
import os
import requests
response = requests.get(
'https://api.financedata.com/v1/signals/MACD/AAPL',
params={
'start_date': '2025-01-01',
'end_date': '2025-04-30',
'fast': 12,
'slow': 26,
'signal_period': 9,
},
headers={'X-API-Key': os.environ['FDA_KEY']},
timeout=30,
)
response.raise_for_status()
print(response.json())MCP example
Tool call body
{
"name": "get_macd",
"arguments": {
"symbol": "AAPL",
"start_date": "2025-01-01",
"end_date": "2025-04-30",
"fast": 12,
"slow": 26,
"signal_period": 9
}
}Agent prompt that triggers it
Run MACD for AAPL and summarize whether the latest line crossover is bullish or bearish.