Signals
SMA — Simple Moving Average
Smooth price action with a classic rolling average.
What it is
The Simple Moving Average is the unweighted mean of the last N closing prices. It smooths day-to-day noise and gives you a baseline trend line.
When to use it
- Tracking medium- and long-term trend direction with 20-, 50-, or 200-day windows.
- Building crossover rules such as
SMA_20 > SMA_50. - Creating a simple benchmark before testing more reactive indicators.
The maths
SMA(N) = (close[t] + close[t-1] + ... + close[t-N+1]) / N — the unweighted mean of the last N closing prices.
What it tells you
A rising SMA indicates an uptrend; a falling SMA indicates a downtrend. A price crossing above its SMA is often treated as a bullish signal; crossing below as bearish.
REST example
python
import os
import requests
response = requests.get(
'https://api.financedata.com/v1/signals/SMA/AAPL',
params={'start_date': '2025-01-01', 'end_date': '2025-04-30', 'period': 20},
headers={'X-API-Key': os.environ['FDA_KEY']},
timeout=30,
)
response.raise_for_status()
print(response.json())MCP example
Tool call body
{
"name": "get_sma",
"arguments": {
"symbol": "AAPL",
"start_date": "2025-01-01",
"end_date": "2025-04-30",
"period": 20
}
}Agent prompt that triggers it
What was AAPL doing relative to its 20-day simple moving average through April 2025?