Signals
STOCH — Stochastic Oscillator
Compare the close to its recent range with %K and %D outputs.
What it is
Stochastic Oscillator compares the latest close to the recent trading range and returns two lines: fast %K and smoothed %D.
When to use it
- Looking for overbought or oversold reversals inside well-defined ranges.
- Watching %K and %D crossovers as short-term momentum timing signals.
- Confirming exhaustion after a sharp multi-day move.
The maths
%K = 100 × (close - lowest_low(N)) / (highest_high(N) - lowest_low(N)), %D = SMA(3) of %K The default N is 14.
What it tells you
Above 80 is overbought and below 20 is oversold. %K crossing above %D is a buy signal, while crossing below is a sell signal, and it is generally more reliable in ranging markets than in strong trends.
REST example
python
import os
import requests
response = requests.get(
'https://api.financedata.com/v1/signals/STOCH/SPY',
params={'start_date': '2025-01-01', 'end_date': '2025-04-30', 'k_period': 14, 'd_period': 3},
headers={'X-API-Key': os.environ['FDA_KEY']},
timeout=30,
)
response.raise_for_status()
print(response.json())MCP example
Tool call body
{
"name": "run_signals",
"arguments": {
"symbols": ["SPY"],
"signal_names": ["STOCH"],
"start_date": "2025-01-01",
"end_date": "2025-04-30",
"signal_parameters": {
"STOCH": { "k_period": 14, "d_period": 3 }
}
}
}Because STOCH returns both k and d, MCP batch output is useful when you want the agent to reason about crossovers directly.
Agent prompt that triggers it
Compute STOCH for SPY and tell me whether the latest %K/%D configuration looks overbought, oversold, or neutral.