Indicators›Momentum›Stochastic
GET/indicator/stoch

Stochastic Oscillator

Category: Momentum · Updated November 2026


The TAAPI.IO Stochastic API returns the Stochastic Oscillator's %K and %D lines as JSON for crypto pairs and US stocks. Send an exchange, symbol and timeframe to get real-time or historical values, with no candles to download and no calculations to maintain.

What one request returns

  • The two lines: valueK, where the close sits in the recent high-low range from 0 to 100, and valueD, its moving average.
  • A series, with results: one pair of values per candle, oldest first, to find crossovers.
  • Several timeframes at once, with /bulk: for example a 4-hour Stochastic for signals and a daily trend check, in one request.

So one call answers two questions: is the close near the top or bottom of its range, and has momentum just turned?

Example: buy signals in a falling market, 20 October to 14 November 2026

Request: one /bulk call for SOLUSDT on 4-hour Binance candles, with the Stochastic (results=2, backtrack=1, so the last two closed candles). Sent at 22:37 UTC on 14 November with the default settings of 5, 3 and 3.

Candle%K%DReading
4h, 14 Nov 12:0011.559.96%K above %D below 20: a bullish crossover
4h, 14 Nov 16:0012.5211.09Still above %D, no new crossover

How to interpret this: A %K crossing above %D below 20 is the textbook buy signal, and SOL gave it on 14 November at 12:00, at 73.89. The next candle closed at 72.24, a new low. That was the fourth such signal since 20 October, and the pattern was the same each time. On 22 October, 6 November and 10 November SOL rose by up to 3.5% within a day, then made a lower low. By 14 November it was 13% to 30% below each signal. The one bearish crossover above 80, on 28 October at 102.75, came at the top of a bounce, and SOL fell 2.3% over the next day. In a downtrend the close keeps landing near the bottom of its range, so the Stochastic keeps showing oversold. That describes the trend. It doesn't predict a turn. A trader who only took crossovers in the direction of the daily trend would have skipped the November buys and kept the October sell.

SOLUSDT 4-hour candles and Stochastic 5, 3, 3, 20 October to 14 November 2026 SOL fell from about 106 to 72. The Stochastic gave one bearish crossover above 80, on 28 October at 102.75, and four bullish crossovers below 20. Each bullish crossover was followed by a lower low. 70 80 90 100 110 20 50 80 Stochastic 5, 3, 3 (4h) 20 Oct 24 Oct 28 Oct 1 Nov 5 Nov 9 Nov 13 Nov Bearish cross at 102.75 %K %D %K crosses below %D above 80 %K crosses above %D below 20 SOLUSDT · Binance 4h candles · Stochastic 5, 3, 3 · 20 Oct – 14 Nov 2026 (closed candles)
Top: SOLUSDT 4-hour candles. Bottom: %K (blue) and %D (amber) with the 80 and 20 levels. Green markers show bullish crossovers below 20 and red markers bearish crossovers above 80.
CrossoverDateSOL close%KOne day laterBy 14 Nov 16:00Daily trend
Bullish22 Oct 16:00103.6316.9−0.1%−30.3%up
Bearish28 Oct 08:00102.7584.3−2.3%−29.7%down
Bullish6 Nov 04:0089.6815.1+0.6%−19.4%down
Bullish10 Nov 16:0082.9519.8+2.3%−12.9%down
Bullish14 Nov 12:0073.8911.6—−2.2%down

Values are from the production API on 14 November 2026, using closed 4-hour candles. "One day later" compares the close six candles on. The daily trend is the previous daily close against its 50-day EMA. Five signals are an illustration, not a backtest. Nothing here is financial advice.

SpecValue
EndpointGET https://v2.taapi.io/indicator/stoch
Outputs%K, %D, timestamp
Default settingsK period 5, D period 3, K smoothing 3
MarketsBinance, Binance Futures, Bybit, Gate.io, Kraken and US stocks
Timeframes1m to 1w
DeliveryREST, bulk and WebSocket

Get Stochastic with one API call

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

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

Stochastic API response

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

200 OK
{
  "valueK": [34.3772073598305],
  "valueD": [31.551435483400635],
  "timestamp": [1794218400]
}
FieldTypeDescription
valueKnumber[]K
valueDnumber[]D
timestampinteger[]Unix time of each candle, in seconds

Stochastic 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
kPeriodintegerNo14Candles in the high-low range
dPeriodintegerNo3Moving average length for %D
kSmoothintegerNo3Smoothing applied to raw %K
resultsintegerNo1Number of values to return, or max
backtrackintegerNo0Candles to skip from the most recent

What is the Stochastic Oscillator?

The Stochastic Oscillator, popularised by George Lane, shows where the close sits within the recent high-low range on a scale of 0 to 100. The idea is that closes cluster near the highs in uptrends and near the lows in downtrends.

Stochastic formula

OutputCalculation
Raw %K(close − lowest low) ÷ (highest high − lowest low) × 100, over kPeriod candles
%KAverage of the last kSmooth raw %K values
%DAverage of the last dPeriod %K values

On the 14 November 16:00 candle, SOL's highest high over 14 candles was 82.80 and its lowest low 71.67, and it closed at 72.24. So raw %K is (72.24 − 71.67) ÷ (82.80 − 71.67) × 100 = 5.12. The average of the last three raw values gives %K = 8.35, and the average of the last three %K values gives %D = 7.65.

How to read the Stochastic in your code

SignalMeaningCondition
OverboughtClose near the top of its rangevalueK above 80
OversoldClose near the bottom of its rangevalueK below 20
Bullish crossoverMomentum turning upvalueK crosses above valueD
Bearish crossoverMomentum turning downvalueK crosses below valueD

Limitations: it stays pinned near the extremes during strong trends, as in the example. Nothing on this page is financial advice.

Fast, slow and full stochastic

The names describe how much smoothing is applied. The fast stochastic uses raw %K, the slow version smooths %K once, and a full stochastic lets you set every length. On this endpoint, kSmooth controls that smoothing, which makes it a full stochastic.

Two related endpoints are available. stochf returns the unsmoothed fast form, and stochrsi applies the same maths to RSI rather than price.

Using the Stochastic in trends

In a rally the close keeps landing near the top of the range, so %K can remain above 80 for a long time. That is the indicator working as designed, and not a reason to sell. Crossovers are generally more useful when taken in the direction of the larger trend: buying oversold crossovers in an uptrend, for instance.

The API defaults to 14, 3, 3, the same settings TradingView and most charting tools use, so values line up with a chart of the same exchange without extra parameters.

Detect a Stochastic crossover in oversold with Python

This looks for %K crossing above %D while %K is below 20, using the common 14, 3, 3 settings on the last two closed candles.

curl -G https://v2.taapi.io/indicator/stoch \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "exchange=binance" \
  --data-urlencode "symbol=BTCUSDT" \
  --data-urlencode "timeframe=1h" \
  --data-urlencode "kPeriod=14" \
  --data-urlencode "dPeriod=3" \
  --data-urlencode "kSmooth=3" \
  --data-urlencode "results=2" \
  --data-urlencode "backtrack=1"

Filter crossovers with the daily trend

Crossovers on short timeframes fire often, and in a trend most of the ones against it fail, as in the example. A common fix is to take a 4-hour crossover only when the daily trend agrees, here the previous daily close against its 50-day EMA. One /bulk request returns both. Two constructs need the Pro plan or above. On Basic, make two GET requests instead.

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

The response at 22:37 UTC on 14 November. The last crossover happened one candle earlier, and SOL's daily close of 78.19 is far below its 50-day EMA of 97.55, so the script prints No crossover in a zone (%K 12.5, %D 11.1), daily trend down. Run at 16:05 UTC, just after the 12:00 candle closed, it would have printed Crossover against the daily downtrend: skip.

200 OK
{
  "sol_4h": {
    "stoch": {
      "valueK": [11.553528761090655, 12.520411190701886],
      "valueD": [9.96263463455284, 11.093952084687736],
      "timestamp": [1794657600, 1794672000]
    }
  },
  "sol_1d": {
    "ema50": {
      "value": [97.54767533658503],
      "timestamp": [1794528000]
    },
    "close": {
      "value": [78.19],
      "timestamp": [1794528000]
    }
  }
}

Since 20 October this rule would have taken two signals: the bullish crossover on 22 October, when SOL's daily close was 0.16 above its EMA (−0.1% a day later), and the bearish one on 28 October (−2.3%). It skipped the three November buys. Two of those bounced by a day's end, but all three were lower within days.

Get historical Stochastic 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/stoch \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data-urlencode "exchange=binance" \
  --data-urlencode "symbol=BTCUSDT" \
  --data-urlencode "timeframe=1h" \
  --data-urlencode "results=100"

Get Stochastic for multiple symbols

Combine Stochastic 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": "stoch",
          "indicator": "stoch"
        },
        {
          "id": "rsi",
          "indicator": "rsi"
        }
      ]
    }
  ]
}'

Stream Stochastic 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": "stoch",
  "exchange": "binance",
  "symbol": "BTCUSDT",
  "interval": "1m",
  "indicator": "stoch"
}

Why Stochastic values can differ between platforms

  • Settings: This endpoint defaults to 14, 3, 3, like TradingView. If your chart uses other lengths, pass the same kPeriod, kSmooth and dPeriod.
  • Exchange data: Highs and lows vary between exchanges, and the stochastic depends directly on them.
  • Open candle: Compare closed candles with backtrack=1.

Stochastic API FAQ

What does the Stochastic API return?

Two arrays, valueK and valueD, plus a timestamp for each candle.

Does this match the Stochastic on TradingView?

Yes. The defaults are 14, 3, 3, the same as TradingView's built-in Stochastic, so compare a closed candle from the same exchange and the values match. The old stochtv endpoint now returns exactly what stoch returns.

Is a bullish crossover below 20 a buy signal?

Not on its own. In a downtrend it fires repeatedly while price keeps falling, as in the example above. Checking a higher-timeframe trend filters out many of these.

Is the latest Stochastic 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 the Stochastic 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 Stochastic on Binance, Bybit or US stocks. Start for free or browse all 262 indicators.