On one chart, %K can mean raw Close position; on another, it already contains smoothing. Define the calculation order before comparing Stochastic values. The same line names do not guarantee identical results, and 80 is neither a return probability nor a fundamental valuation.

Three stages: raw R, smoothed K and smoothed D

For a closed bar, let C be its Close, L the lowest Low and H the highest High across the last N bars including the current one. With H > L, raw R = 100(C − L)/(H − L). The extremes come from the OHLC window, not only from closes.

Our explicit model then uses K = SMA(R,s) and D = SMA(K,d). Require complete windows at every stage and retain intermediate precision. Missing observations are not zeros. This smooths oscillator outputs, rather than replacing the price series with its average.

TradingView documents separate K-window, K-smoothing and D-period fields. Record their names and averaging convention, not just a tuple of three numbers. A raw value and a smoothed K can differ without either calculation being inconsistent.

Stochastic on an aggregate is not the mean of shorter readings

Two arbitrary candles have OHLC: A=(100, 110, 90, 110), B=(110, 130, 100, 120). At N=1, raw A is 100 and B about 66.67; their mean is 83.33. Aggregated OHLC=(100, 130, 90, 120) gives a raw result 75.

Scroll sideways to see the full diagram

OHLC aggregation and oscillator calculation are not interchangeableTwo shorter candles yield raw readings 100 and 66.67, averaging 83.33. The combined candle has range 90–130 and Close 120, yielding 75.Aggregate first or average the outputs?Two candles N=1One aggregated candle10066.6775Mean of two readings:83.33Aggregate reading:75These are different calculations.
Shared price scale: Low 90 is lowest and High 130 highest. Numbers beneath candles are indicator readings.

Aggregation selects the highest High, lowest Low and final Close. Averaging outputs instead combines two ratios with different denominators. To obtain a higher-timeframe indicator, calculate it from that timeframe’s candles; do not substitute a mean of lower readings without defining a different tool.

Assumptions: Complete arbitrary OHLC, two consecutive candles without a gap. N=1 and no smoothing deliberately isolate operation order; this is not a recommended setting. Formula or data reference: MetaTrader 5: Stochastic formula.

Fast, slow and full are named conventions

Convention described by ChartSchool; not every platform
VariantKD
FastRaw RUsually SMA3 of K
SlowSMA3 of RUsually SMA3 of smoothed K
FullSMA of R with chosen sSMA of K with chosen d

Here full with s = 1 skips the first smoothing; s = 3 and d = 3 gives slow. Fast D equals slow K only when they use identical R and the same three-period SMA. These formulas do not assign fast to M5, slow to H4 or a profitable variant to any interval.

A complete seven-candle model

Use N = 3, s = 2 and d = 2 solely to learn the calculation. All prices below are hypothetical, in arbitrary units; all bars are closed. Open is included for OHLC validation, although this formula does not use it.

All input OHLC values, oldest first
BarOpenHighLowClose
110012080100
210011090100
310011090104
410411090104
510411090108
61081109092
79211090100
N = 3, s = 2, d = 2; — means insufficient window
BarWindow Low / HighRK = SMA2(R)D = SMA2(K)
380 / 12060——
490 / 1107065—
590 / 110908072.5
690 / 110105065
790 / 110503040

Bar 3 gives R = 100(104 − 80)/40 = 60. At bar 4, the first candle’s extremes leave the window: R becomes 100(104 − 90)/20 = 70 despite unchanged Close. The first K is (60 + 70)/2 = 65. At bar 5, K = 80 and first D = (65 + 80)/2 = 72.5. At bar 7, R = 50, K = 30 and D = 40: three different stages.

Smoothed values have a different interpretation

Raw R describes the latest Close within its current range. K and D combine earlier readings, potentially calculated from different extreme windows. At bar 5, K = 80 while raw R = 90. With valid OHLC and positive range width, R stays within 0–100; SMAs of those values do too. That mathematical bound does not create a probability of a profitable trade.

A trend-following rule or a separately defined support or resistance level is a further hypothesis. Neither turns one oscillator event into a certified entry or guarantees an ATR-based stop is safe.

Flat ranges and the first available output

If the entire window has H = L, the ratio is mathematically undefined. The read TA-Lib 0.6.4 STOCH code sets raw output to 0 in its zero-range branch before averaging. That is a software convention, not evidence of selling pressure. Other implementations require separate checking; our exercise instead marks a flat range unavailable and does not average across it.

Under full-window SMAs, first R is at bar N, first K at N + s − 1, and first D at N + s + d − 2: bars 3,4,5 here. A library may return K and D together only when D exists. A display beginning later need not mean another formula.

Two SMA2 stages do not equal one SMA3

Substitute K(t) = [R(t) + R(t−1)]/2 into D(t) = [K(t) + K(t−1)]/2. Then D(t) = [R(t) + 2 R(t−1) + R(t−2)]/4. The middle value appears in both overlapping windows. Its effective weight is 1/2; the outer weights are 1/4 each.

Assigned raw impulse 0,0,100,0,0; indexes from zero
IndexD after two SMA2 stagesOne SMA3
22533⅓
35033⅓
42533⅓

These assigned raw values can represent closes at the maximum or minimum of a positive range. Both filters start with three observations but give different outputs. Replacing the two stages with SMA3 changes the calculation and potentially crossings with K. Divergence with other oscillators also requires its own point-pairing and recognition-time rules; it is not a proven strongest signal.

Aggregation order and signal time matter

The diagram separately uses A = (100,110,90,110) and B = (110,130,100,120). At N = 1 their raw readings are 100 and 66⅔, mean 83⅓. Aggregating OHLC first gives (100,130,90,120), hence raw 75. Averaging ratios with different denominators is a different operation from computing the ratio on an aggregate. For the quiz’s final Close of 110, the aggregate result is 50.

For a downward crossing, one rule is prior K ≥ D and current K < D. Bar 6 satisfies it: prior 80 > 72.5, then 50 < 65. That identifies an event, without assuming a trade outcome. If the rule uses final Close, wait until the bar is closed and the observation known.

Reproduce one changed input

Change only bar 7’s Close to 106, keeping High 110 and Low 90. Raw R = 80; with prior R = 10, K = 45. Prior K = 50, so D = 47.5. Raw 80 and smoothed 45 are not contradictory.

Record data source, interval, time zone, N, s, d, average types, flat-range policy and confirmation time before evaluating a strategy. The technical analysis section on ForexMechanics provides related reading. The Stochastic interpretation article explains the raw/smoothed distinction; RSI compares another indicator construction. An extra filter, a selected candle or a fixed month of observation does not establish an edge.