Stochastic Oscillator Calculator
Stochastic oscillator calculator: get %K and %D from the close, the high-low range and previous values. Follow a worked example and see why charts differ.
A stochastic oscillator locates a closing price within its recent high-low range. Enter the close, the range and previous indicator values in this calculator to get its Percent K, Percent D, Zone and Crossover results. This form smooths by averaging repeated previous values, so its displayed readings are approximations rather than a complete standard stochastic calculation. The worked example below shows exactly why its Percent K can differ from the raw formula printed above.
The form does not collect the earlier observations needed for full smoothing. A crossover label based on these approximate outputs is not a verified chart event. Check a complete series with matching settings before comparing results.
A close near the top of its range
The raw calculation is: Fast %K = (Close - Lowest Low) / (Highest High - Lowest Low) x 100. The high and low come from the same lookback window, including the bar whose close you are measuring. A bar is a chart interval, such as a completed daily session or an intraday interval.
For valid data within a non-flat range, the raw result runs from zero to 100. It is a location within that window, not a percentage return, a probability of profit or an estimate of how far price will move. An identical closing price can have a different reading when an older high or low leaves the lookback window.
Fidelity describes stochastic as a momentum indicator comparing the close with the high-low range. MetaQuotes’ documentation likewise distinguishes the main line from its moving-average signal line. A moving average smooths several observations; it cannot be reconstructed reliably from a single earlier value.
Use the five fields as they are labelled
- Current Close: the closing price for the bar you are analysing. Use a completed bar for a stable comparison.
- 14-Period High: the highest traded high across the same 14-bar window. It is not an average of the highs or merely the highest closing price.
- 14-Period Low: the lowest traded low in that window.
- Previous %K: the previous indicator value, using the same symbol and chart interval.
- Previous %D: the previous signal-line value from that same setup.
There is no symbol selector, price-history field or smoothing-period control. You supply the high and low yourself. The labels specify 14 periods; they do not mean calendar days when you are studying intraday bars. The helper text mentions today and yesterday, but the arithmetic itself simply uses the values entered.
Use one price basis throughout. Do not take a current close from one chart interval and the range from another. Also check whether a chart adjusts earlier prices for corporate actions before comparing its indicator with independently copied numbers. This form does not reconcile mismatched data for you.
Why Percent K is not the raw Fast %K
In the standard fast version, %D is commonly a three-period simple moving average of raw %K. In a slow version, the raw %K is smoothed first, then the slow %D averages the smoothed readings. StockCharts’ own documentation separates fast, slow and fully adjustable versions. The names therefore matter when comparing indicators.
This form follows a shorter route. It calculates the current raw %K, adds Previous %K twice, then divides the total by 3. That becomes the displayed Percent K. It then adds Previous %D twice to that result and divides by 3 for Percent D. Repeating a previous reading is a substitute for missing history; it is not the same as averaging distinct observations.
The tool also treats an entered zero for Previous %K or Previous %D as missing and substitutes a fallback. Zero is a legitimate boundary reading in a stochastic series, so this changes an otherwise valid input. A different result from your chart may therefore reflect both the smoothing shortcut and the zero-value handling.
How to calculate %K and %D step by step
To calculate the stochastic oscillator by hand you need a series of bars, not a single day. Each bar needs a high, a low and a close. The steps for the fast version are: take the highest high and lowest low of the last 14 bars, including the current one; subtract the lowest low from the close; divide by the range between the highest high and the lowest low; multiply by 100. That gives %K. Then %D is a 3-bar simple moving average (the plain average of the last three values) of %K.
Below is a made-up 16-bar daily series. The prices are invented to show the arithmetic and are not data for any share or index. %K can only start from bar 14, because that is the first bar with a full 14-bar window.
| Bar | High | Low | Close |
|---|---|---|---|
| 1 | 102 | 98 | 100 |
| 2 | 104 | 100 | 103 |
| 3 | 103 | 99 | 101 |
| 4 | 105 | 101 | 104 |
| 5 | 107 | 103 | 106 |
| 6 | 106 | 102 | 104 |
| 7 | 108 | 104 | 107 |
| 8 | 110 | 106 | 109 |
| 9 | 109 | 105 | 106 |
| 10 | 111 | 107 | 110 |
| 11 | 113 | 109 | 111 |
| 12 | 112 | 108 | 110 |
| 13 | 114 | 110 | 113 |
| 14 | 115 | 111 | 112 |
| 15 | 113 | 109 | 112 |
| 16 | 116 | 111 | 115 |
| Bar | Window used | Highest high | Lowest low | Close | Raw %K |
|---|---|---|---|---|---|
| 14 | Bars 1 to 14 | 115 | 98 | 112 | (112 - 98) / (115 - 98) x 100 = 82.35 |
| 15 | Bars 2 to 15 | 115 | 99 | 112 | (112 - 99) / (115 - 99) x 100 = 81.25 |
| 16 | Bars 3 to 16 | 116 | 99 | 115 | (115 - 99) / (116 - 99) x 100 = 94.12 |
Fast %D on bar 16 is the average of the last three raw %K values: (82.35 + 81.25 + 94.12) / 3 = 85.91. Notice how the window moves. On bar 15 the lowest low rose from 98 to 99 because bar 1 dropped out of the window. That is why the same close can give a different reading on a later day.
Compare this with the calculator above. It asks for one close, one high and one low, plus your previous %K and %D. It cannot see the earlier bars, so it repeats the previous value instead. The step-by-step method here uses real earlier readings, which is how a chart does it.
Fast, slow and full stochastic explained
StockCharts describes three versions. They share the same raw %K and differ only in how much smoothing (averaging to reduce noise) is applied.
| Version | %K line | %D line | Common setting |
|---|---|---|---|
| Fast | Raw %K | 3-period SMA of raw %K | 14,3 |
| Slow | Raw %K smoothed by a 3-period SMA | 3-period SMA of slow %K | 14,3 |
| Full | Raw %K smoothed by an X-period SMA | X-period SMA of full %K | 14,3,3 |
The slow version is the same as a full stochastic with 14,3,3 settings. The third number is the smoothing, sometimes called slowing, applied to %K. A larger smoothing number makes the line calmer and slower to react. A shorter look-back gives a more jumpy line that touches 0 and 100 more often.
What settings like 14,3,3 or 9,6 mean
Settings are read in order: look-back, then smoothing of %K, then the %D period. So 14,3,3 means a 14-bar range, a 3-bar smoothing of %K and a 3-bar %D. A shorthand such as stoch(9,6) is usually read as a 9-bar look-back and a 6-bar %D or smoothing value, but the order differs between charting platforms. Open your platform's indicator settings and read the labels before comparing numbers with anyone else.
- Shorter look-back (for example 5 or 9): reacts faster, spends more time near 0 and 100, and gives more false extremes.
- Longer look-back (for example 21): reacts slower and shows fewer extremes.
- Longer smoothing: fewer line crossings, but each crossing arrives later.
- The same settings on a 5-minute chart and a daily chart describe very different amounts of time.
Stochastic oscillator in a spreadsheet
You can rebuild the fast version in Excel or Google Sheets. Put the high in column B, the low in column C and the close in column D, with data starting in row 2. In row 15 (the 14th bar), enter these formulas:
- Raw %K in E15: =(D15-MIN(C2:C15))/(MAX(B2:B15)-MIN(C2:C15))*100
- Fast %D in F17, once E15 to E17 are filled: =AVERAGE(E15:E17)
- Slow %K: the same AVERAGE formula over three raw %K cells; slow %D then averages three slow %K cells.
Copy the %K formula down. The spreadsheet adjusts the ranges so the window moves one row at a time. If the highest high equals the lowest low the range is zero and the formula returns an error; wrap it in IF to show a blank for flat windows.
Stochastic vs RSI vs Stochastic RSI
| Indicator | What it measures | Typical default | Usual extreme zones |
|---|---|---|---|
| Stochastic oscillator | Where the close sits inside the recent high-low range | 14,3,3 | Above 80 and below 20 |
| RSI | Average gains compared with average losses over the period (J. Welles Wilder, 1978) | 14 | Above 70 and below 30 |
| Stochastic RSI | A stochastic formula applied to RSI values instead of prices | Platform dependent | Platform dependent |
Neither is better. They answer different questions, so identical readings do not mean the same thing. A stochastic reading depends on the recent high and low. RSI depends on the size of recent gains and losses. Our pages on the RSI indicator and Stochastic RSI explain each one.
Using these readings in a journal
If you use a stochastic reading in a trade, write down the settings, the chart interval and the reading on the bar you acted on. Later you can compare outcomes by setting, rather than guessing which version you used. OneTradeJournal records trades by hand, with strategy and notes fields for exactly this. It does not import chart data and gives no signals. See also the stochastic trading strategy page.
A fictional calculation from price range to output
For this made-up example, enter Current Close ₹2,460, 14-Period High ₹2,520, 14-Period Low ₹2,280, Previous %K 60 and Previous %D 55. These are invented prices and indicator readings, not data for a particular share or index.
| Step | Arithmetic | Result |
|---|---|---|
| Close above window low | 2,460 - 2,280 | 180 |
| Window range | 2,520 - 2,280 | 240 |
| Raw Fast %K | 180 / 240 x 100 | 75 |
| Displayed Percent K | (75 + 60 + 60) / 3 | 65% |
| Displayed Percent D | (65 + 55 + 55) / 3 | 58.33% |
The display calls this BULLISH ZONE because the smoothed K is in the upper half of its scale. Its Crossover result says Bullish (%K above %D). In the example, the previous K was already above the previous D, so that text describes the current relationship. It does not mean a new crossing just occurred.
Notice the difference between the raw 75 and the displayed 65. The formula shown above the tool describes the raw calculation, while its result card uses the smoothed shortcut. Changing the high and low alone does not resolve that difference. A full calculation needs separate earlier K observations and the corresponding smoothed history.
Zone names describe readings, not orders
The usual convention calls readings above 80 overbought and below 20 oversold. Those words describe where the oscillator is on its scale. They do not mean an asset is fundamentally expensive or cheap. A strong trend can keep the oscillator near an extreme while prices continue moving in the same direction.
A crossing also needs a before-and-after comparison of the same lines. Seeing K above D on a single bar is insufficient to show it crossed on that bar. This form compares the entered previous values with its newly approximated values, so its crossing label inherits the approximation. It does not establish what happened on a complete chart.
If both lines are equal, the result can still label their relationship bearish, meaning downward. A flat price window can also produce a fallback indicator value rather than explaining that the raw formula has no nonzero range to divide by. These cases are reasons to inspect the inputs, not evidence of a market direction.
What to compare when chart readings disagree
- Check the same symbol, bar interval and completed-bar timestamp.
- Check the window high and low, including whether the current bar belongs to that window.
- Check whether the chart shows fast, slow or full stochastic.
- Check the lookback, smoothing lengths and averaging method.
- Allow for this form’s repeated-value shortcut and zero-input fallback; matching the settings cannot remove missing history.
The stochastic strategy explanation adds context about interpretation and failure cases. For a different oscillator, see the RSI calculator. RSI measures a different relationship, so identical thresholds or readings should not be assumed to mean the same thing.
The similarly named Stochastic RSI applies a stochastic calculation to RSI values, rather than directly using this price window. The stochastic momentum index is another separate indicator. Confirm which indicator your chart uses before trying to reconcile its result with this form.
Stochastic calculator questions
Sources
- Fidelity: fast stochastic definitions, checked 15 Oct 2026.
- StockCharts: fast, slow and full stochastic, checked 15 Oct 2026.
- MetaQuotes: formula and smoothing choices, checked 15 Oct 2026.
Related Topics
Related Articles
Absolute Returns Calculator: Total Gain or Loss
Absolute return calculator with formula, worked rupee examples and a comparison with CAGR and XIRR. Learn when absolute return misleads, such as for SIPs.
Options Rollover Calculator
Work out the debit or credit of rolling an option from premiums and lots. Learn roll up, down and out, charges, STT, and futures rollover cost and percentage.
Options Probability Calculator: Model Inputs and Limits
Estimate an option's expected move and price range from price, volatility and days to expiry, with a worked example and why the probability cards need care.
Trading Expectancy Calculator: Formula and Example
Trading expectancy calculator (EV per trade) from win rate, average win and average loss. See R-multiples, profit factor, sample size and low win-rate examples.
Trading Emotion Tracker: Review Feelings and Plan Discipline
Free trading emotion tracker. Log the mood, intensity and plan discipline behind a trade, get a simple rule-based score, and keep a record to review later.
MACD Calculator: Line, Signal and Histogram
Calculate the MACD line, signal line and histogram from your moving averages, with the formula, a worked example and how to read crossovers.
The trading journal for Nifty, Bank Nifty and Indian F&O. Track your trades, spot patterns, build discipline.
- Log one trade a day by hand, on purpose
- AI mentor finds your repeat mistakes
- Behavioural analytics catch tilt early
- Trading calendar with P&L heatmap
- Pre-trade checklist flags risks
Yearly ₹3,499 · No broker credentials