GET/indicator/ema

Exponential Moving Average (EMA)

Category: Trend · Updated November 2026


The TAAPI.IO EMA API returns the Exponential Moving Average as JSON for crypto pairs and US stocks. Send an exchange, symbol, timeframe and period to get real-time or historical values, with no candles to download and no calculations to maintain.

What one request returns

  • The average (value): an average of recent closes that weights the newest ones most. The default period is 30, and source lets you average the open, high or low instead.
  • A series, with results: one value per candle, oldest first, for slopes, crossovers and backtests.
  • A stack of averages, with /bulk: for example the 21, 50 and 200 EMA and the latest close in one request.

So one call answers two questions: is the market trending, and is price stretched away from its trend or pulling back to it?

Example: an uptrend that respected its 50 EMA, August to November 2026

Request: one /bulk call for AAPL on daily US stock candles, with the 21, 50 and 200-day EMA and the closing price. Sent at 22:37 UTC on Saturday 14 November, so the latest candle is Friday's close.

LineValueClose vs lineReading
Close, 13 Nov355.40—Two trading days after the record close of 356.35
EMA 21345.95+2.7%Short-term trend up
EMA 50338.51+5.0%Medium-term trend up
EMA 200307.24+15.7%Long-term trend up. 21 above 50 above 200: a stacked uptrend

How to interpret this: AAPL rose from 325.14 on 1 September to a record close of 356.35 on 11 November, a gain of 9.3%. Through that run the 50-day EMA acted as a floor. 58 of the last 60 daily closes were above it. On 30 October the low touched it almost exactly, at 334.35 against an EMA of 334.31, and the stock closed at 345.10. The only closes below it since 17 August came on 2 and 3 November, at 328.81 and 329.82. On 4 November AAPL closed back above the line with a 6.4% gain, and a week later it set the record. For a trend follower, those two days were the pullback, not the end of the trend: the 21, 50 and 200 EMA stayed stacked in order the whole time. Today the close is 2.7% above the 21 EMA, so by the same rules there is no pullback to buy.

AAPL daily candles with the 21-day and 50-day EMA, August to November 2026 AAPL rose from about 310 to a record close of 356.35 on 11 November. After 17 August it closed below the 50-day EMA on only two days, 2 and 3 November, and closed back above it on 4 November with a 6.4% gain. 300 310 320 330 340 350 360 Aug Sep Oct Nov Only two closes below the 50 EMA since 17 Aug, then +6.4% back above it on 4 Nov Record close 356.35 EMA 21 EMA 50 Close below EMA 50 Back above AAPL · US stocks, daily candles · EMA 21 and EMA 50 · 3 Aug – 13 Nov 2026
AAPL daily candles with the 21-day EMA (blue) and 50-day EMA (amber). Red circles mark the only two closes below the 50 EMA since 17 August, and the triangle the close back above it.
DateAAPL closeEMA 50What happened
30 Oct345.10334.31Low of 334.35 touched the EMA, close held above
2 Nov328.81334.10First close below the 50 EMA since 17 August
3 Nov329.82333.93Second close below
4 Nov350.78334.59Back above with a 6.4% gain
11 Nov356.35337.12Record close

Values are from the production API on 14 November 2026, using daily closes. One pullback is an illustration, not a backtest. Nothing here is financial advice.

SpecValue
EndpointGET https://v2.taapi.io/indicator/ema
OutputsEMA value, timestamp
Default settingsPeriod 30, source close
MarketsBinance, Binance Futures, Bybit, Gate.io, Kraken and US stocks
Timeframes1m to 1w
DeliveryREST, bulk and WebSocket

Get EMA with one API call

This request returns EMA for BTCUSDT on 1-hour Binance candles. Add your API key to run it here.

curl -G https://v2.taapi.io/indicator/ema \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "exchange=binance" \
  --data-urlencode "symbol=BTCUSDT" \
  --data-urlencode "timeframe=1h"

EMA API response

This response came from the live API on 9 November 2026.

200 OK
{
  "value": [75084.74679900207],
  "timestamp": [1794218400]
}
FieldTypeDescription
valuenumber[]EMA result
timestampinteger[]Unix time of each candle, in seconds

EMA API parameters

NameTypeRequiredDefaultDescription
exchangestringYes—binance, binancefutures, bybit, gateio, kraken or stocks
symbolstringYes—Pair or ticker, e.g. BTCUSDT or AAPL
timeframestringYes—1m 5m 15m 1h 4h 1d 1w
periodintegerNo30Number of candles in the average
sourcestringNoclosePrice to average: close, open, high or low
resultsintegerNo1Number of values to return, or max
backtrackintegerNo0Candles to skip from the most recent

What is EMA?

The Exponential Moving Average is a moving average that gives more weight to recent prices, so it responds faster than a simple moving average of the same length. It is the building block of MACD and many other indicators.

EMA formula

OutputCalculation
Multiplier2 ÷ (period + 1)
EMA(close − previous EMA) × multiplier + previous EMA

For the 21-day EMA the multiplier is 2 ÷ 22, about 0.091. In the example, the EMA was 345.00 on 12 November and AAPL closed at 355.40 on 13 November, so the new EMA is (355.40 − 345.00) × 0.091 + 345.00 = 345.95.

How to read EMA in your code

SignalMeaningCondition
Price above averageBullish biasClose above value
Price below averageBearish biasClose below value
Stacked uptrendShort, medium and long trend agreeEMA 21 above EMA 50 above EMA 200
PullbackPrice back near its trendClose between EMA 21 and EMA 50 in a stacked uptrend
Golden crossShort-term trend overtakes long-termEMA(50) crosses above EMA(200)
Death crossShort-term trend falls under long-termEMA(50) crosses below EMA(200)

Limitations: An EMA depends on all earlier data, so values can differ slightly from a chart with a different amount of history. Like every average, it lags price, and a single close below it, as on 2 November, is often noise. Nothing on this page is financial advice.

EMA vs SMA

A simple moving average weights every candle in the window equally and forgets a candle completely when it leaves. An EMA weights the newest candle most, and older candles fade gradually without ever fully dropping out.

The multiplier sets how fast that happens. A 9-period EMA gives the latest close a weight of 20%, while a 200-period EMA gives it about 1%. So an EMA turns sooner than an SMA of the same length, which also means it reacts more to noise.

Using several EMAs together

Many systems compare averages rather than reading one alone. A fast EMA crossing a slow one marks a change in trend, and a stack such as 9 above 21 above 50 describes an orderly uptrend. Bulk requests are made for this: you can ask for several periods of the same indicator in one call, as long as each has its own id.

Crossovers are lagging by construction, because the averages can only cross after price has already moved. In ranges they produce repeated small losses, so many traders only use them alongside a measure of trend strength such as ADX.

Detect a 50/200 EMA golden cross with Python

One bulk request fetches both averages for the last two closed candles. Each indicator gets its own id, which becomes its key in the response.

curl -X POST https://v2.taapi.io/bulk \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "constructs": [
    {
      "id": "btc",
      "exchange": "binance",
      "symbol": "BTCUSDT",
      "timeframe": "1h",
      "indicators": [
        {
          "id": "ema50",
          "indicator": "ema",
          "period": 50,
          "results": 2,
          "backtrack": 1
        },
        {
          "id": "ema200",
          "indicator": "ema",
          "period": 200,
          "results": 2,
          "backtrack": 1
        }
      ]
    }
  ]
}'

Check trend and pullback with three EMAs

A common trend-following rule: only buy when the 21, 50 and 200 EMA are stacked in order, and only when price has pulled back below the 21 EMA without closing below the 50. One /bulk request returns all three averages and the close. It uses one construct, so it works on every plan. For crypto, or for stocks during market hours, add backtrack=1 to each indicator.

POST/bulk
curl -X POST https://v2.taapi.io/bulk \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "constructs": [
    {
      "id": "aapl_1d",
      "exchange": "stocks",
      "symbol": "AAPL",
      "timeframe": "1d",
      "indicators": [
        {
          "id": "ema21",
          "indicator": "ema",
          "period": 21
        },
        {
          "id": "ema50",
          "indicator": "ema",
          "period": 50
        },
        {
          "id": "ema200",
          "indicator": "ema",
          "period": 200
        },
        {
          "id": "close",
          "indicator": "price"
        }
      ]
    }
  ]
}'

The response at 22:37 UTC on 14 November. The averages are stacked and the close is above the 21 EMA, so the script prints Uptrend, close 2.7% above the 21 EMA: no pullback yet. On 3 November it would have printed Uptrend, but the close is below the 50 EMA: wait, and on 30 October, when AAPL closed between the two lines, Uptrend pullback: the close is between the 21 and 50 EMA.

200 OK
{
  "aapl_1d": {
    "ema21": {
      "value": [345.94999996903226],
      "timestamp": [1794528000]
    },
    "ema50": {
      "value": [338.5051075732595],
      "timestamp": [1794528000]
    },
    "ema200": {
      "value": [307.2411880702818],
      "timestamp": [1794528000]
    },
    "close": {
      "value": [355.4],
      "timestamp": [1794528000]
    }
  }
}

Pullback rules buy weakness inside a trend, so they lose when the trend ends. A common safeguard is to exit on a daily close below the 50 EMA, or below the 200 EMA for a slower system.

Get historical EMA values

Add results to return a series for backtesting or charting. The last element is the most recent candle.

curl -G https://v2.taapi.io/indicator/ema \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "exchange=binance" \
  --data-urlencode "symbol=BTCUSDT" \
  --data-urlencode "timeframe=1h" \
  --data-urlencode "results=100"

Get EMA for multiple symbols

Combine EMA with other indicators in one request. Each exchange, symbol and timeframe combination is one construct: Basic allows 1 per request, Pro 3 and Expert 10.

POST/bulk
curl -X POST https://v2.taapi.io/bulk \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "constructs": [
    {
      "id": "btc_1h",
      "exchange": "binance",
      "symbol": "BTCUSDT",
      "timeframe": "1h",
      "indicators": [
        {
          "id": "ema",
          "indicator": "ema"
        },
        {
          "id": "rsi",
          "indicator": "rsi"
        }
      ]
    }
  ]
}'

Stream EMA in real time

Subscribe over WebSocket to receive new values every 5 seconds while the candle is forming. Streaming supports 1m, 5m, 15m and 1h, and uses interval where REST uses timeframe.

WSSwss://v2.taapi.io/streaming
{
  "type": "subscribe",
  "id": "ema",
  "exchange": "binance",
  "symbol": "BTCUSDT",
  "interval": "1m",
  "indicator": "ema"
}

Common EMA settings

These are starting points, not recommendations. Test any setting on your own market and timeframe.

SettingsCharacterTypical use
9, 21FastIntraday pullbacks and crossovers
50MediumSwing trend filter
200SlowLong-term trend filter

Why EMA values can differ between platforms

  • Warm-up history: An EMA depends on every earlier candle, so the amount of history behind a calculation affects the result. The effect is largest on long periods.
  • Seed value: Platforms start the first EMA differently, commonly from an SMA or from the first close.
  • Input price: The default input is the close. Use source if your chart uses something else.
  • Exchange data: Each exchange has its own candles.

EMA API FAQ

What does the EMA API return?

An array of averages in value, plus a timestamp for each candle.

Can I get several EMA periods at once?

Yes. Send a POST /bulk request with several ema indicators, each with its own period and id. See Check trend and pullback with three EMAs.

Can I calculate the EMA of something other than the close?

Yes. Set source to open, high or low. The default is close.

Is the latest EMA value final?

No. The newest value belongs to the candle still forming and can change until it closes. Add backtrack=1 to read the last closed candle.

Can I get EMA for US stocks?

Yes. Use exchange=stocks with a ticker such as AAPL. US stocks are included on the Pro plan and above.

Build with EMA on Binance, Bybit or US stocks. Start for free or browse all 262 indicators.