Browse all documentation

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://api.narwhalapi.com. The MCP tool is equities, with one action for each route below.

What every account gets

WhatEvery account
Technical indicatorsIncluded
HistoryEvery 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_cursor; 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

ParameterWhereRequiredTypeMeaning
idpathYesstringListing 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.
functionqueryYesone of sma, ema, wma, rsi, macd, bbands, atr, stochastic, adx, dmi, cci, sar, stochrsisma, 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.
periodqueryNointegerBars 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_periodqueryNointegermacd fast EMA, 2 to 400, default 12. Less than slow_period.
slow_periodqueryNointegermacd slow EMA, 2 to 400, default 26.
signal_periodqueryNointegermacd signal EMA, 2 to 400, default 9.
fast_kperiodqueryNointegerstochastic fast %K window, or stochrsi RSI period and %K window, 2 to 400, default 14.
slow_kperiodqueryNointegerstochastic slow %K average, 2 to 400, default 3.
slow_dperiodqueryNointegerstochastic %D average, 2 to 400, default 3.
fast_dperiodqueryNointegerstochrsi %D average, 2 to 400, default 3.
accelerationqueryNostringsar acceleration factor, 0.001 to 1 (up to 4 decimals), default 0.02.
maximumqueryNostringsar largest acceleration factor, 0.001 to 1, default 0.2. At least acceleration.
startqueryNostringFirst date to return (inclusive). The calculation starts at the first bar.
endqueryNostringLast date to return (inclusive).
cursorqueryNostringThe next_cursor of the previous page.

Response fields

FieldTypeSentMeaning
idstringAlwaysCanonical listing id.
functionone of sma, ema, wma, rsi, macd, bbands, atr, stochastic, adx, dmi, cci, sar, stochrsiAlways
periodintegerOptionalThe period used. For the single-period functions.
fast_periodintegerOptionalThe macd fast period used.
slow_periodintegerOptionalThe macd slow period used.
signal_periodintegerOptionalThe macd signal period used.
fast_kperiodintegerOptionalThe stochastic fast %K window used.
slow_kperiodintegerOptionalThe stochastic slow %K average used.
slow_dperiodintegerOptionalThe stochastic %D average used.
fast_dperiodintegerOptionalThe stochrsi %D average used.
accelerationstringOptionalThe sar acceleration factor used.
maximumstringOptionalThe sar largest acceleration factor used.
adjustedalways trueAlwaysThe bars are adjusted for splits and dividends, as the bars route's are.
startdateOptionalSent when the plan's history window raised start.
valueslist of objectAlwaysOldest 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[].datedateAlwaysThe session date the value is as of (its close).
values[].smastringOptionalSimple moving average of the close.
values[].emastringOptionalExponential moving average of the close.
values[].wmastringOptionalLinearly weighted moving average of the close.
values[].rsistringOptionalRelative strength index, 0 to 100.
values[].atrstringOptionalAverage true range, in the price's currency.
values[].macdstringOptionalFast EMA minus slow EMA of the close.
values[].signalstringOptionalEMA of the macd line.
values[].divergencestringOptionalmacd minus signal.
values[].ubandstringOptionalUpper Bollinger band: middle + 2 standard deviations.
values[].mbandstringOptionalMiddle Bollinger band: simple average of the close.
values[].lbandstringOptionalLower Bollinger band: middle - 2 standard deviations.
values[].adxstringOptionalAverage directional index, 0 to 100.
values[].dmistringOptionalDirectional movement index (DX), 0 to 100.
values[].ccistringOptionalCommodity channel index.
values[].sarstringOptionalParabolic stop and reverse, in the price's currency.
values[].fastklinestringOptionalStochastic RSI %K, 0 to 100.
values[].fastdlinestringOptionalStochastic RSI %D, the average of %K, 0 to 100.
values[].k_valuesstringOptionalStochastic slow %K, 0 to 100.
values[].d_valuesstringOptionalStochastic %D, the average of slow %K, 0 to 100.
next_cursorstringAlwaysPass as cursor for the next page; null on the last page.
methodology_urlalways "https://narwhalapi.com/docs/api/stocks/technicals"OptionalThe formula and the seed of each function.
Request
curl -H "Authorization: Bearer $NARWHAL_API_KEY" \
  "https://api.narwhalapi.com/v1/equities/XNAS:AAPL/technicals?function=rsi&period=14&start=2026-11-10"
Example response
{
  "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_id. See Errors and credits for the shape and the credit headers. Failed requests are not charged.

CodeStatusMeaning
invalid_query400A parameter is missing, unknown, repeated or outside its range.
invalid_id400An id or pair is not written the way this API expects.
not_found404No such listing, fund or pair.
not_covered404The market, country or company is not covered yet.
invalid_cursor400The cursor is not one this request returned, or it comes from a different request.
cursor_expired409The prices behind the cursor changed. Start again without the cursor.
insufficient_credits402Your credit balance is less than the request costs.
upstream_busy503A price could not be fetched now. In a batch it is listed in errors. Try again shortly.
area_unavailable503This area cannot answer right now.

Was this page helpful?