What is the stochastic oscillator?

The stochastic oscillator is a momentum indicator credited to George C. Lane, who developed and popularized it in the late 1950s. It does not measure price itself but where the close lands within the range of the last few bars: near the top of the range the reading is high, near the bottom it is low.

The idea: in a rally, closes tend to land near the highs; in a decline, near the lows. Lane described the indicator as following the speed, or momentum, of price, and argued that momentum tends to change direction before price does. Hence the classic signals, crosses in the extreme zones and divergence. The drawing at the top shows a cross under 20 as price turns up, then both lines above 80.

%K
The main line: where the latest close sits in the look-back range, from 0 (at the low) to 100 (at the high).
%D
The signal line: a moving average of %K, usually over 3 periods. %K crossing it marks a turn in momentum.
Overbought (above 80)
Recent closes landed near the top of the range: a description of strength, not a forecast of a drop.
Oversold (below 20)
Recent closes landed near the bottom of the range. In a downtrend the reading can stay there for a long time.

Stochastic formula: how %K and %D are calculated

TradingView does the math for you, but the formula explains how the indicator behaves. The three steps, with the usual look-back of 14 bars, are listed below.

Hypothetical, on a 5-minute chart: over the last 14 bars the highest high is $52.00 and the lowest low $48.00, and the bar closes at $51.40. %K = 100 × 3.40 ÷ 4.00 = 85. If the last three %K values are 85, 76 and 70, %D is 77. A close at $48.00 would read 0, at $52.00 it would read 100, and at $50.00, the middle of the range, 50.

Two consequences follow. A close at the top of the range reads 100 whether the range is $4.00 or $0.40, so the stochastic says nothing about how far price has traveled. And a narrow range makes it jumpy: if the 14-bar range is only $0.30 during a quiet midday stretch, a $0.15 move swings %K by 50 points.

  1. Find the highest high and the lowest low of the last 14 bars (highs and lows, not closes).
  2. %K = 100 × (close − lowest low) ÷ (highest high − lowest low).
  3. %D = the 3-period simple moving average of %K.

Overbought and oversold: why 80 and 20 are not sell and buy signals

By convention, readings above 80 are overbought and below 20 oversold, and those are the default bands on TradingView. Overbought only means recent closes sit near the top of the range. In a strong uptrend that is exactly what happens bar after bar, so the lines can stay pinned above 80 for hours on an intraday chart.

A hypothetical failed short on a 5-minute chart: a stock climbs from $80.00 to $83.00 in the morning while slow %K holds between 80 and 98 for over an hour. A trader shorts at $83.00 when %K crosses below %D at 88, with a stop at $83.40, $0.40 of risk per share. Price pauses for two bars, then pushes on. The stop is hit, 100 shares lose $40, and the stock reaches $84.50 by lunch.

Oversold works the same way in a downtrend, where buying every reading under 20 means buying one lower low after another; the drawing below shows that trap with price bands instead of an oscillator. In a trend, wait for a pullback to a level instead of fading the move.

Turn your phone sideways to read the drawing. Tap to close.

A strong downtrend in which price keeps riding below its lower band. Three buy attempts labeled looks stretched are each crossed out as price keeps falling, under a note reading in a trend, stretched gets more stretched.

Fast vs slow stochastic: the best stochastic indicator settings

The raw line is jumpy, so most charts smooth it; the three versions below differ only in how many times %K is averaged. In the drawing, the fast panel crosses again and again and the slow one only a couple of times. Fewer crosses mean fewer false signals, though no setting removes them.

Start with 14, 3, 3 and change the chart timeframe rather than the numbers. On a 5-minute chart 14 bars cover 70 minutes; on a 15-minute chart, three and a half hours; on a 1-minute chart, 14 minutes, which is mostly noise. Shorter look-backs such as 5 or 9 hit the extremes far more often and give more false readings; longer ones such as 21 rarely touch 80 or 20.

  • Fast stochastic: %K is the raw formula and %D is its 3-period average. Quick, with many crosses.
  • Slow stochastic: the fast %D becomes the slow %K (the raw line averaged over 3 periods), and the slow %D is a 3-period average of that. Smoother, with fewer and slightly later crosses.
  • Full stochastic: you choose all three numbers, the look-back, the %K smoothing and the %D period. Set to 14, 3, 3 it equals the classic slow stochastic; 14, 1, 3 equals the fast one.

Turn your phone sideways to read the drawing. Tap to close.

The same prices read two ways. In the top panel, labeled fast, a jagged %K line crosses its %D many times; in the bottom panel, labeled slow, the lines are smoother and cross only a couple of times.

How to trade stochastic crossovers at a level: a worked example

A %K–%D cross carries weight only in an extreme zone and at a price level that already matters; a cross near 50 happens constantly and says little. The full checklist is below.

Hypothetical: a stock has spent two days between support at $71.50–$71.80 and resistance at $74.00. On the 15-minute chart with a slow stochastic (14, 3, 3), price touches $71.55 and %K falls to 12. The next candle closes at $72.10, back above the zone, as %K crosses above %D at 18. You buy at $72.10 with a stop at $71.40 below the zone, $0.70 of risk per share. The target is $73.80, just under resistance: $1.70 of reward, about 2.4 times the risk. Risking $70 means 100 shares; the position size calculator does the math.

The failure is just as common. Another day the same cross prints under 20 on a candle that closes inside the zone, not above it, and the next candle closes at $71.35, below the zone: no trade, because support broke and the cross only showed that the drop paused for a bar. If you were already long, the stop at $71.40 takes you out for the planned $70. The stop comes from the level, never from the stochastic; see stop loss and take profit and the risk/reward ratio.

The drawing below shows the part that matters most: price rejects a marked support zone, and only then does a buy signal print. Mirrored, a cross below %D above 80 at resistance, confirmed by a close back under it, gives a short. Ranges suit this best; see the range trading strategy.

UpTickFlow, our invite-only TradingView indicator, works in the same order, so weigh this accordingly. It does not read the stochastic or detect crossovers: it waits for a candle to close at a level, draws the entry, stop and target before the trade, scores the setup from 0 to 100 and stays quiet in chop. A second check, not a scanner.

  1. Level: price is at a support or resistance zone you marked before it got there.
  2. Context: the higher timeframe is not trending hard against you; see multi-timeframe analysis.
  3. Reading: %K crosses %D below 20 at support, or above 80 at resistance.
  4. Trigger: a candle closes back on your side of the level.
  5. Plan: stop beyond the level, target before the next level, size from the stop.

Turn your phone sideways to read the drawing. Tap to close.

A resistance zone above and a support zone below; price dips into the support zone, rejects it, and a buy signal prints.

Stochastic divergence: when momentum and price disagree

Bullish divergence is a lower low in price with a higher low on the stochastic; bearish divergence is a higher high in price with a lower high on the stochastic. Lane himself treated a divergence between %D and price as the key signal, since momentum tends to turn first.

Hypothetical: a stock falls to $40.00 with %K at 5, bounces to $41.20, then slides to a lower low at $39.60, but %K only drops to 18, a higher low. The selling is losing force, but it is not over. The trigger is still a close: a 15-minute candle back above $40.00, the earlier low, with a stop under $39.60. If price keeps falling and the stochastic makes a lower low too, the divergence is gone and there is no trade.

In a strong trend divergence can print two or three times before price turns, so take it only at a level. The drawing below shows the bullish shape with an RSI panel; on the stochastic you compare the same two lows. Hidden divergence is covered in our RSI divergence guide.

Turn your phone sideways to read the drawing. Tap to close.

Price makes a lower low while the RSI panel below makes a higher low, so the two slope in opposite directions: a bullish divergence.

Stochastic vs RSI: what is the difference?

Both are momentum oscillators on a 0 to 100 scale, and both commonly use 14 periods, but they measure different things. The RSI, introduced by J. Welles Wilder Jr. in 1978, compares the average size of up moves with down moves. The stochastic only asks where the close sits inside the high–low range.

The stochastic tends to be more sensitive: it reaches its extremes more often and flips faster, which is why its bands sit at 80 and 20 rather than 70 and 30. Many traders use RSI to judge a trend and the stochastic to time turns inside a range.

Pick one: the stochastic, RSI and MACD all measure momentum, so three of them agreeing is one opinion counted three times. TradingView’s separate Stochastic RSI runs the stochastic formula on RSI values instead of price, which makes it faster still, and noisier.

How to add the stochastic oscillator on TradingView

The stochastic is built into TradingView and available on every plan, including the free one. The steps:

  1. Open a chart and click Indicators in the top toolbar, or press the / key.
  2. Type Stochastic and pick the built-in Stochastic under Technicals, not Stochastic RSI or the Stochastic Momentum Index. It opens in its own panel under the price chart.
  3. Hover over its name and click the gear icon. The Inputs tab holds three numbers: the %K length, the %K smoothing and the %D smoothing. TradingView’s help page lists the defaults as 14, 3 and 3, the classic slow setting.
  4. Check the %K smoothing before you trust a reading: at 1 you are looking at the fast stochastic, at 3 the slow one.
  5. The default bands sit at 80 and 20, and you can move them in the settings. To be notified instead of watching, set an alert; our TradingView alerts guide shows how.

When the stochastic oscillator fails: common mistakes

Like every indicator, the stochastic fails often, and a failed signal looks exactly like a good one at first. Most of the damage comes from a few habits:

  • Selling every reading above 80 and buying every reading below 20 in a trending market.
  • Trading crosses around 50, where they happen all the time.
  • Acting before the candle closes. On the live bar a cross can vanish by the close, so judge closed candles only; see how to read candlesticks.
  • Trusting the first bars of the session. At the 9:30 a.m. ET open the 14-bar range still includes yesterday’s last bars, so a gap can push %K to 0 or 100 in a single bar; see US stock market hours.
  • Ignoring location. A cross at a marked level is information; the same cross in empty space is not. See the support and resistance strategy.
  • Changing the settings after every loss, or trading without a stop. The stochastic never tells you where you are wrong; the chart does.