Stochastic Oscillator Calculator
Calculate fast and slow stochastic %K and %D from a series of highs, lows and closes.
The stochastic oscillator says where the latest close sits inside the range the last n bars actually traded. If the highest high across that window is 53.90 and the lowest low is 50.90, a close of 53.00 sits 70% of the way up a three-point range, and 70 is the raw reading. That is the entire content of the number, and this stochastic oscillator calculator works it out from highs, lows and closes you type in yourself, returning %K and %D together with the window they were measured inside.
Formula: %K = 100 x (close - lowest low) / (highest high - lowest low)
Your figures
Fast takes %K raw. Slow smooths it first, which makes the slow %K identical to the fast %D at the same lengths.
How many bars the highest high and lowest low are taken over. Conventionally 14.
Slow variant only: how many raw %K values are averaged into the %K shown. Conventionally 3. The fast variant does not use this box at all.
How many %K values are averaged into %D. Conventionally 3.
Results
%K
73.10
Slow stochastic, 14/3/3, from 20 bars
- %DA simple mean of the last 3 %K values.
- 75.79
- Highest high in the windowThe highest high of the last 14 bars.
- 106.7000
- Lowest low in the windowThe lowest low over the same 14 bars.
- 100.0000
- Range of the windowHighest high less lowest low — the denominator the raw %K divides by.
- 6.7000
- Latest closeWhere this sits inside the range above is the whole of the raw reading.
- 104.3000
- Raw %K at the latest barBefore smoothing. The %K shown above is the mean of the last 3 raw values.
- 64.18
- %K smoothingHow many raw values are averaged into %K on the slow variant.
- 3
- Variant%K is the raw reading smoothed, and %D smooths it again.
- Slow
- Bars usedRows left wholly blank are dropped rather than counted.
- 20
- %K values in the seriesThe first cannot appear before bar 14, since there is no window to measure a position within until then.
- 5
What this means
Over the last 14 bars the highest high is 106.7000 and the lowest low 100.0000, a range of 6.7000. The latest close of 104.3000 sits 64.18% of the way up that range, which is the raw %K. Taking the mean of the last 3 raw %K values gives the %K shown, 73.10, and the mean of the last 3 %K values gives %D at 75.79. The figure describes where one close sits inside a range that has already traded, and nothing else — a series can sit near the top of its own range for weeks while the range itself drifts either way.
- %K says where the latest close sits inside the range the last n bars actually traded: 100 is the very top of that range, 0 the very bottom, 50 halfway. That is the whole content of the number. It says nothing about how wide the range is, nothing about whether the range is unusual, and nothing about what the next bar does.
- The slow variant's %K is the fast variant's %D at the same lengths. That is why a chart labelled Stochastic (14, 3, 3) is ambiguous until you know which form the package drew, and why the two can be compared only once that is settled.
- A window whose highest high equals its lowest low has no range for a close to sit inside, so it contributes the midpoint by convention. That is not an exotic case — a thinly traded instrument or a quiet holiday session reaches it — and the count of such windows is reported above whenever there are any.
- Only the extremes of the window and the latest close matter. A bar that spiked far past its own close moves the highest high without moving where the close sits, which is a property of the measure rather than an oversight here.
- The rows are treated as consecutive periods in the order given, whatever they are: minutes, days or weeks. Nothing here knows about sessions, weekends or holidays, so a series with a bar missing from the middle is measured as though the two either side of the hole were adjacent.
- Every figure on this page is taken from periods that have already traded. It describes what the series has done, and no reading of it — high, low or anywhere between — carries information about what the next period does.
%K: 73.10
The link reopens this calculator with the same numbers. Nothing you enter is sent to a server.
Continue with these figures
About the Stochastic Oscillator calculation
It is bounded between 0 and 100 by construction rather than by clamping. The latest close is one of the prices inside the window, so it cannot be above the highest high or below the lowest low, which keeps the numerator between zero and the range on every bar. A reading of 100 means the close finished at the very top of that window and 0 the very bottom — neither is an extreme in any statistical sense, only an end of a range that has already traded.
The oscillator exists in forms whose names are unhelpfully similar and whose difference is entirely real: the slow form's %K is the fast form's %D. A chart labelled Stochastic (14, 3, 3) is ambiguous until you know which one the package drew, so the variant is a choice on this page rather than a decision taken silently, and the result names it. Slow is the default because it is what most platforms show under the plain word stochastic.
One case has no measured answer at all. When every bar in the window traded at a single price the highest high equals the lowest low, the range is zero, and the close is at the top and the bottom of something with no width. That is not exotic — a thinly traded instrument or a quiet session reaches it — so the calculator returns the midpoint by convention and reports how many windows took it.
Stochastic Oscillator formula
over the last n bars ending at t:
highest high = max( high_{t−n+1} … high_t )
lowest low = min( low_{t−n+1} … low_t )
range = highest high − lowest low
raw %K_t = 100 × (close_t − lowest low) ÷ range
Fast %K = raw %K
%D = mean of the last d values of %K
Slow %K = mean of the last s values of raw %K
%D = mean of the last d values of that %K
range = 0 → reading = 50 by convention
rows needed: fast n + d − 1
slow n + s + d − 2- n
- The %K period — how many bars the highest high and the lowest low are taken across. Conventionally 14, and a field here rather than a constant.
- s
- The %K smoothing length, used by the slow variant only: how many raw %K values are averaged into the %K shown. Setting it to 1 gives the fast variant back.
- d
- The %D period — how many %K values are averaged into %D. It counts readings rather than bars, which is why it costs look-back on top of the %K period.
- range
- Highest high less lowest low: the width the close is being placed inside, and the denominator of the raw reading. It changes as extremes roll out of the window.
- raw %K
- The unsmoothed reading at one bar. On the fast variant it is %K itself; on the slow variant it is the input the smoothing averages.
The denominator in the stochastic indicator formula is the window's own range, which makes the reading a position rather than a size. Two windows can both place their close at 70 while one spanned three points and the other thirty, and the oscillator cannot tell them apart — the range is the unit it measures in, and that unit changes on every bar. This is what makes the figure comparable across instruments, and simultaneously what stops it saying anything about how far the instrument has been moving. The average true range is the measure that answers that second question.
The slow stochastic formula is the fast one with the same arithmetic applied a further time, and the relationship is exact rather than approximate. Smoothing the raw %K over s values is precisely what the fast form does to produce its %D, so a slow %K at 14 and 3 equals a fast %D at 14 and 3, value for value. The form often called full is the slow one with all three lengths exposed separately, which is what the slow variant here is. Setting the smoothing to 1 collapses it back into the fast form, and the page will do that without complaint.
A window with no range is handled as a definition rather than as arithmetic, because the alternatives are each worse in an obvious way. A NaN puts a broken value on screen. A 0 claims the close finished at the bottom of the range and a 100 claims the top, and both are equally true and equally false when the two ends are the same price. The midpoint is the only answer that does not favour an end of a range that has collapsed, and the panel counts how many windows took it so a convention is never mistaken for a measurement.
Every stage of smoothing costs look-back, and the costs add rather than overlap. The first raw %K cannot exist until n bars do; averaging it over s values costs s − 1 more; taking %D over d of those costs d − 1 again. A slow 14/3/3 therefore needs eighteen rows before it can report anything and a fast 14/3 needs sixteen, which is why the table opens with twenty. It also means %D is not a second measurement but the same one averaged again, so by construction it moves later and less far than %K.
Stochastic Oscillator: a worked example
Seven bars with highs of 52.40, 52.80, 53.10, 52.70, 52.30, 53.60 and 53.90, lows of 51.20, 51.60, 52.00, 51.40, 50.90, 51.80 and 52.70, and closes of 51.90, 52.60, 52.20, 51.70, 51.10, 53.40 and 53.00, read as a fast stochastic over five bars with a three-value %D.
- Window ending at bar 5highest high 53.10, lowest low 50.90, range 2.20; close 51.10 → 100 × 0.20 ÷ 2.20 = 9.0909
- Window ending at bar 6highest high 53.60, lowest low 50.90, range 2.70; close 53.40 → 100 × 2.50 ÷ 2.70 = 92.5926
- Window ending at bar 7highest high 53.90, lowest low 50.90, range 3.00; close 53.00 → 100 × 2.10 ÷ 3.00 = 70.0000
- Fast %Kthe raw reading itself, 70.00
- Fast %D(9.0909 + 92.5926 + 70.0000) ÷ 3 = 57.2278
- Slow %K at 5 and 3the same 57.2278, by the identity between the two forms
A fast %K of 70.00 with a %D of 57.23. The close of 53.00 sits seven tenths of the way up a three-point range whose low of 50.90 was set two bars earlier and is still the lowest in the window; when that bar eventually rolls out, the denominator changes and the reading moves even if the price does not. The 57.23 is worth holding onto, because it is exactly what a slow stochastic at the same 5 and 3 reports as its %K — the two forms are one calculation counted from different places.
How to use the Stochastic Oscillator calculator
- Choose the variant first. Fast and slow produce different numbers from identical bars: a fast stochastic calculator reports the raw reading as %K, while the slow one smooths that first and needs more rows before it can report anything at all.
- Set the %K period — how many bars the highest high and lowest low are taken over. Fourteen is what the field opens on, and the table opens with twenty rows so it works immediately.
- Set the %K smoothing if the slow variant is selected, and the %D period either way. The fast variant ignores the smoothing box entirely, which is why it stays on the form rather than being hidden.
- Fill the table oldest at the top, with a high, a low and a close for every period. Rows left wholly blank are ignored; a row with only some boxes filled is refused by row number.
- Read the %K and %D this stochastic calculator returns alongside the highest high, lowest low and range rows. Those three are the window the number was measured inside, and they shift as extremes roll out of it.
Limitations of the Stochastic Oscillator calculator
Every calculation makes assumptions. These are the ones that matter here.
- The reading is a position inside a range and says nothing about the size of it. A %K of 90 in a three-point window and a %K of 90 in a thirty-point window are the same number about very different bars.
- The denominator changes as bars roll out of the window, so the reading can move on a period where the price barely did. That is inherent in the measure rather than a fault in the arithmetic.
- Fast, slow and full are separate conventions producing different numbers from identical bars, so a reading here matches a chart only once both are known to use the same one.
- A window whose highest high equals its lowest low has no measured answer, and the midpoint returned there is a convention rather than a reading. The count of such windows is reported.
- No threshold is reported. The 80 and 20 lines are conventional markings rather than properties of the calculation, and a close at the top of a range that has traded implies nothing about the next bar.
- Rows are treated as consecutive periods in the order given, so a bar missing from the middle narrows what the window covers without the calculator being able to tell.
Frequently asked questions about Stochastic Oscillator
What is the difference between the fast, slow and full stochastic?
One calculation reported at three depths of smoothing. The fast form shows the raw reading as %K and a mean of it as %D. The slow form shifts everything along one place: its %K is that mean, and its %D a mean of that again. The full form is the slow one with all three lengths exposed separately, which is what the slow variant here is. Two platforms drawing different forms disagree substantially on identical data.
What happens when every bar in the window traded at the same price?
The range is zero and there is no position inside it to measure, so the calculator returns 50 and says that it did. That is a convention rather than a measurement: with both ends of the range at one price, a close is at the top and the bottom at once, and 0 and 100 are as defensible as each other. The panel reports how many windows were affected, so a run of them is visible rather than hidden inside the average.
Do the 80 and 20 lines mean overbought and oversold?
This page reports no threshold and draws no line. What a %K of 92 says is that the latest close finished 92% of the way up the range the last n bars traded in. It does not say the range was wide, that the price is high by any other measure, or that the next bar does anything — a series can print readings above 80 for weeks while continuing upwards, and nothing in the arithmetic separates that case from any other.
How many rows does a slow 14/3/3 reading need?
Eighteen. The first raw %K needs fourteen bars, smoothing it over three values costs two more, and taking %D over three of those costs two again — fourteen plus two plus two. A fast 14/3 needs sixteen by the same reasoning, since it skips the middle stage. The calculator names the exact figure when there are too few rows, so it is clear whether to add rows or shorten a period.
Does %K use the whole bar or only the close?
Both, in different roles. The highest high and the lowest low come from the highs and lows of every bar in the window, so the full trading range of each period sets the boundaries. The position inside those boundaries is taken from the latest close alone. That split is why a bar can move the reading substantially without its own close moving much: it widened the window rather than repositioning anything inside it.
Can the reading move when the price has not?
Yes, and it is one of the more useful things to understand about the measure. If the bar setting the window's lowest low rolls out of the look-back, the denominator changes and the same close sits at a different fraction of a different range. Nothing about the instrument changed; the window it is measured against did. On short look-backs that is frequent enough to be worth checking the range row before reading anything into a shift.
Last reviewed . See our methodology and editorial policy.
More technical calculators