Technical indicators API reference
Moving averages, RSI, MACD, Bollinger bands, ATR and stochastic of a stock, with the formula of each
Overview
Technical indicators of a stock, worked out on request from the same split- and dividend-adjusted daily bars the bars route serves. Thirteen functions, named and answered as EODHD names them, so a client written for EODHD changes only its address: sma, ema, wma, rsi, macd, bbands, atr, stochastic, adx, dmi, cci, sar and stochrsi.
Every value is worked out from the listing's first daily bar, with the TA-Lib method, so a value does not depend on the start you ask for. start and end only choose which dates come back. The first row of a function is the first bar that has every one of its fields.
One call is one call, and a page of up to 5,000 rows is one call. Send next_cursor back as cursor for the next page.
Base URL: https:/. The MCP tool is equities, with one action for each route below.
What every account gets
| What | Every account |
|---|---|
| Technical indicators | Included |
| History | Every date from the listing's first bar |
See pricing for what a call costs. A request is charged at the price of its API unless a route says otherwise.
- Formulas, with the seed of each. Prices are the adjusted close, high and low, and every value is printed with 4 decimal places.
- sma: the simple average of the last period closes. ema: the seed is the simple average of the first period closes, then ema = ema + (close - ema) x 2 / (period + 1). wma: the last period closes weighted 1 to period, the newest heaviest, divided by period x (period + 1) / 2.
- rsi: Wilder's. The seed is the average gain and the average loss of the first period daily changes; then each average = (average x (period - 1) + this change's gain or loss) / period; rsi = 100 x gain / (gain + loss), and 0 when both are 0.
- macd: the fast EMA minus the slow EMA of the close (12 and 26). The slow EMA is seeded on the first slow closes. As TA-Lib does, the fast EMA is seeded on the average of the fast closes that end where the slow EMA starts, so the two begin on the same bar. signal is the EMA (9) of the macd line, seeded on its first signal values, and divergence is macd minus signal. The row starts at the first bar that has a signal.
- bbands: mband is the simple average of the last period closes (20), uband and lband are two population standard deviations (divided by period, not period - 1) above and below it.
- atr: Wilder's. The true range of a bar is the largest of high minus low, the absolute high minus the previous close and the absolute low minus the previous close. The seed is the average of the first period true ranges, then atr = (atr x (period - 1) + true range) / period. It is in the price's currency.
- stochastic: fast %K = 100 x (close - lowest low) / (highest high - lowest low) over fast_kperiod bars (0 when the range is 0). k_values is the simple average of fast %K over slow_kperiod, and d_values the simple average of k_values over slow_dperiod. Defaults 14, 3, 3.
- adx: Wilder's average directional index. The +DM, -DM and true range are smoothed the Wilder way (the seed is their sum over the first period - 1 changes, then each = each - each / period + this bar's); +DI and -DI are 100 x the smoothed DM over the smoothed true range, DX = 100 x |+DI - -DI| / (+DI + -DI), and adx is the average of the first period DX values, then adx = (adx x (period - 1) + DX) / period. Its first row is bar 2 x period.
- dmi: the directional movement index, the DX of the adx calculation above before the second smoothing (TA-Lib's DX, which is what EODHD calls dmi). Its first row is bar period + 1.
- cci: the typical price is (high + low + close) / 3; cci = (typical price - its simple average over period) / (0.015 x the mean absolute deviation of the typical prices from that average). 0 when the deviation is 0.
- sar: Wilder's parabolic stop and reverse, as TA-Lib's SAR with its automatic start. The direction of the first bar is read from the second bar (long unless its low is lower and lower by more than its high is higher), the first value is the first bar's low (long) or high (short), and the extreme point is the second bar's high or low. Each bar the value moves a share af of the way to the extreme point, af starting at acceleration, rising by acceleration each time a new extreme is made, to at most maximum; it is held outside the last two bars' range, and when the price crosses it the trend reverses to the old extreme point and af starts again. SAR depends on the bar it started on, so it is worked out from the first bar like all of them. Its first row is bar 2.
- stochrsi: TA-Lib's STOCHRSI. The RSI of the close over fast_kperiod bars (seeded as rsi above), then a fast stochastic of that RSI over fast_kperiod bars gives fastkline = 100 x (RSI - lowest RSI) / (highest RSI - lowest RSI), 0 when the range is 0, and fastdline is the simple average of fastkline over fast_dperiod.
- Defaults are the usual ones, not EODHD's 50 for everything: sma, ema and wma 50, rsi 14, atr 14, adx 14, dmi 14, bbands 20, cci 20, macd 12/26/9, stochastic 14/3/3, sar 0.02 and 0.2, stochrsi 14 and 3 (EODHD's stochrsi %D is 14). period is 2 to 400. period is for sma, ema, wma, rsi, bbands, atr, adx, dmi and cci; macd takes fast_period, slow_period (more than fast_period) and signal_period; stochastic takes fast_kperiod, slow_kperiod and slow_dperiod; stochrsi takes fast_kperiod and fast_dperiod; sar takes acceleration and maximum (0.001 to 1, up to 4 decimals, acceleration not more than maximum). A parameter that does not belong to the function is 400 invalid_query.
- A listing with fewer bars than the function needs for one row is 404 not_covered, and so is an unknown id 404 not_found. Neither is charged. A page that is empty because start and end cut every row off is a 200 with no values and is charged.
- The first call for a listing reads its whole bar history from the data vendor and takes a few seconds for an old listing; later calls use what we keep. If a split or dividend changes the adjusted prices between two pages, the cursor stops working and returns 409 cursor_expired: start again from page 1.
- Our values equal TA-Lib's to 4 decimals when both start at the first bar, for all thirteen functions. They can differ from another provider's, which may adjust the prices differently or start its averages at another bar.
Endpoints
Every route is a GET and needs your key in the Authorization: Bearer header. The examples show the shape of an answer, not live data.
Technical indicators of one stock
GET /v1/equities/{id}/technicals
One technical indicator of one stock, worked out from its split- and dividend-adjusted daily bars: sma, ema, wma, rsi, macd, bbands, atr, stochastic, adx, dmi, cci, sar or stochrsi (EODHD's names and field names). Every value is worked out from the listing's first bar with the TA-Lib method, so it does not depend on start; start and end only choose the dates returned. Defaults are the usual ones (RSI 14, SMA 50, MACD 12/26/9). Oldest date first, up to 5,000 rows a page with next_; a cursor that no longer matches the prices is 409 cursor_expired. A listing with too few bars is 404 not_covered. One call a page.
function is required. The answer carries the periods it used: period for the single-period functions, fast_period, slow_period and signal_period for macd, fast_kperiod, slow_kperiod and slow_dperiod for stochastic, fast_kperiod and fast_dperiod for stochrsi, acceleration and maximum for sar.
Fields by function: sma, ema, wma, rsi, atr, adx, dmi, cci and sar give one field named like the function. macd gives macd, signal and divergence. bbands gives uband, mband and lband. stochastic gives k_values and d_values. stochrsi gives fastkline and fastdline.
MCP: tool equities, action technicals.
Parameters
| Parameter | Where | Required | Type | Meaning |
|---|---|---|---|---|
id | path | Yes | string | Listing id: the exchange's four-letter code, a colon and the ticker, for example XNAS:MSFT or XNYS:BRK.B. A bare US ticker such as MSFT also works when it names one US listing; the answer carries the canonical id. Share classes use a dot (BRK.B); BRK-B is accepted. |
function | query | Yes | one of sma, ema, wma, rsi, macd, bbands, atr, stochastic, adx, dmi, cci, sar, stochrsi | sma, ema, wma, rsi, macd, bbands, atr, stochastic, adx, dmi, cci, sar or stochrsi. Each is worked out from the listing's first bar, so a value does not change with start. |
period | query | No | integer | Bars in the window, 2 to 400, for sma, ema, wma, rsi, bbands, atr, adx, dmi and cci. Defaults: 50 for sma, ema and wma, 14 for rsi, atr, adx and dmi, 20 for bbands and cci. |
fast_ | query | No | integer | macd fast EMA, 2 to 400, default 12. Less than slow_. |
slow_ | query | No | integer | macd slow EMA, 2 to 400, default 26. |
signal_ | query | No | integer | macd signal EMA, 2 to 400, default 9. |
fast_ | query | No | integer | stochastic fast %K window, or stochrsi RSI period and %K window, 2 to 400, default 14. |
slow_ | query | No | integer | stochastic slow %K average, 2 to 400, default 3. |
slow_ | query | No | integer | stochastic %D average, 2 to 400, default 3. |
fast_ | query | No | integer | stochrsi %D average, 2 to 400, default 3. |
acceleration | query | No | string | sar acceleration factor, 0.001 to 1 (up to 4 decimals), default 0.02. |
maximum | query | No | string | sar largest acceleration factor, 0.001 to 1, default 0.2. At least acceleration. |
start | query | No | string | First date to return (inclusive). The calculation starts at the first bar. |
end | query | No | string | Last date to return (inclusive). |
cursor | query | No | string | The next_ of the previous page. |
Response fields
| Field | Type | Sent | Meaning |
|---|---|---|---|
id | string | Always | Canonical listing id. |
function | one of sma, ema, wma, rsi, macd, bbands, atr, stochastic, adx, dmi, cci, sar, stochrsi | Always | |
period | integer | Optional | The period used. For the single-period functions. |
fast_ | integer | Optional | The macd fast period used. |
slow_ | integer | Optional | The macd slow period used. |
signal_ | integer | Optional | The macd signal period used. |
fast_ | integer | Optional | The stochastic fast %K window used. |
slow_ | integer | Optional | The stochastic slow %K average used. |
slow_ | integer | Optional | The stochastic %D average used. |
fast_ | integer | Optional | The stochrsi %D average used. |
acceleration | string | Optional | The sar acceleration factor used. |
maximum | string | Optional | The sar largest acceleration factor used. |
adjusted | always true | Always | The bars are adjusted for splits and dividends, as the bars route's are. |
start | date | Optional | Sent when the plan's history window raised start. |
values | list of object | Always | Oldest first, one row for each session from the first bar that has every field of the function (a value needs bars before it: period for an average, period + 1 for rsi and atr). Up to 5,000 rows a page. |
values[].date | date | Always | The session date the value is as of (its close). |
values[].sma | string | Optional | Simple moving average of the close. |
values[].ema | string | Optional | Exponential moving average of the close. |
values[].wma | string | Optional | Linearly weighted moving average of the close. |
values[].rsi | string | Optional | Relative strength index, 0 to 100. |
values[].atr | string | Optional | Average true range, in the price's currency. |
values[].macd | string | Optional | Fast EMA minus slow EMA of the close. |
values[].signal | string | Optional | EMA of the macd line. |
values[].divergence | string | Optional | macd minus signal. |
values[].uband | string | Optional | Upper Bollinger band: middle + 2 standard deviations. |
values[].mband | string | Optional | Middle Bollinger band: simple average of the close. |
values[].lband | string | Optional | Lower Bollinger band: middle - 2 standard deviations. |
values[].adx | string | Optional | Average directional index, 0 to 100. |
values[].dmi | string | Optional | Directional movement index (DX), 0 to 100. |
values[].cci | string | Optional | Commodity channel index. |
values[].sar | string | Optional | Parabolic stop and reverse, in the price's currency. |
values[].fastkline | string | Optional | Stochastic RSI %K, 0 to 100. |
values[].fastdline | string | Optional | Stochastic RSI %D, the average of %K, 0 to 100. |
values[].k_ | string | Optional | Stochastic slow %K, 0 to 100. |
values[].d_ | string | Optional | Stochastic %D, the average of slow %K, 0 to 100. |
next_ | string | Always | Pass as cursor for the next page; null on the last page. |
methodology_ | always "https://narwhalapi.com/docs/api/stocks/technicals" | Optional | The formula and the seed of each function. |
curl -H "Authorization: Bearer $NARWHAL_API_KEY" \
"https://api.narwhalapi.com/v1/equities/XNAS:AAPL/technicals?function=rsi&period=14&start=2026-11-10"{
"id": "XNAS:AAPL",
"function": "rsi",
"period": 14,
"adjusted": true,
"values": [
{
"date": "2026-11-10",
"rsi": "55.6219"
},
{
"date": "2026-11-11",
"rsi": "60.4231"
},
{
"date": "2026-11-12",
"rsi": "59.9563"
},
{
"date": "2026-11-13",
"rsi": "60.9072"
},
{
"date": "2026-11-16",
"rsi": "57.2322"
},
{
"date": "2026-11-17",
"rsi": "56.3716"
}
],
"next_cursor": null,
"methodology_url": "https://narwhalapi.com/docs/api/stocks/technicals"
}Errors
Errors use the shared problem shape with a request_. See Errors and credits for the shape and the credit headers. Failed requests are not charged.
| Code | Status | Meaning |
|---|---|---|
invalid_ | 400 | A parameter is missing, unknown, repeated or outside its range. |
invalid_ | 400 | An id or pair is not written the way this API expects. |
not_ | 404 | No such listing, fund or pair. |
not_ | 404 | The market, country or company is not covered yet. |
invalid_ | 400 | The cursor is not one this request returned, or it comes from a different request. |
cursor_ | 409 | The prices behind the cursor changed. Start again without the cursor. |
insufficient_ | 402 | Your credit balance is less than the request costs. |
upstream_ | 503 | A price could not be fetched now. In a batch it is listed in errors. Try again shortly. |
area_ | 503 | This area cannot answer right now. |
Was this page helpful?