Compute indicators
compute_indicatorsCalculates indicators from prices the user gives. Use it when the user gives their own prices and wants indicators calculated, such as "calculate ATR and stochastic from these candles". Pass prices (2 to 250 candles, oldest first, each with a numeric close and optionally time, open, high, low and volume) and indicators from sma, ema, rsi, macd, bollinger, atr, stochastic and vwap; optionally periods and series_length. atr and stochastic need high and low on every candle, and vwap needs high, low and volume. Returns the latest value and a short series for each indicator, with the settings used. Makes no outside request and keeps nothing. Informational only, not financial advice; gives no signals.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prices | Yes | Candles, oldest first, at most 250 | |
| periods | No | Lookback length per indicator, in candles; any left out use the default shown | |
| indicators | Yes | Indicators to calculate: sma, ema, rsi, macd (12, 26, 9), bollinger (2 standard deviations), atr, stochastic (%K and %D) and vwap (cumulative over the given candles) | |
| series_length | No | How many of the most recent values to return for each indicator, 5 by default |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| asOf | Yes | Date or time of the last price used | |
| error | No | Present when status is not ok: a stable code, what went wrong and what to do next. | |
| notice | Yes | ||
| source | Yes | Where the prices came from | |
| status | Yes | ||
| candles | Yes | Number of candles the indicators were calculated over | |
| library | Yes | The library that did the calculation | |
| skipped | Yes | Requested indicators that could not be calculated, with the reason | |
| indicators | Yes | ||
| latestClose | Yes |