Direct answer
Stochastic Range is calculated by taking a selected “current” price and placing it inside a rolling lookback window defined by the highest high and lowest low. The result is scaled to a bounded value that expresses where the current price sits relative to that past range.
In plain terms: it answers, “Within the last N bars, how close is today’s price to the top of the observed range, and how far is it from the bottom?”
Mechanism and definition
A typical Stochastic Range calculation follows this structure:
- Choose a lookback window length, usually called N.
- For each bar, compute:
- HighestHigh(N) = the maximum of the selected high values over the last N bars
- LowestLow(N) = the minimum of the selected low values over the last N bars
- Select which price you use as the “current” value. A common choice is the current close (but some variants use other price components).
Then compute a scaled position:
Stochastic Range (basic form)
[ KR = \frac{CurrentPrice - LowestLow(N)}{HighestHigh(N) - LowestLow(N)} ]
To express it as a percentage-like measure, some implementations multiply by 100:
[ SR = 100 \times \frac{CurrentPrice - LowestLow(N)}{HighestHigh(N) - LowestLow(N)} ]
Interpretation (without promising signals):
- If CurrentPrice = LowestLow(N), then KR = 0 (or SR = 0).
- If CurrentPrice = HighestHigh(N), then KR = 1 (or SR = 100).
- If CurrentPrice is between the two, the value lies between 0 and 1 (or 0 and 100).
Data requirements
To calculate the above consistently, you need:
- A time series of OHLC (or at least high, low, and a chosen current price such as close).
- A clear definition of the bar boundaries (e.g., daily bars vs. 1-hour bars), because the rolling highs/lows depend on the granularity.
- A fixed lookback length N.
Variant differences (why two charts can disagree)
Stochastic Range is often discussed alongside other “stochastic” indicators, and implementations vary. The most common sources of disagreement are:
- Which “current” price is used (close vs. another component).
- How the highest high and lowest low are computed (e.g., using highs/lows from OHLC, or adjusted inputs).
- Whether smoothing is applied (some versions add moving-average steps before or after scaling).
Because these choices change the computed numbers, you should treat the formula as dependent on the implementation definition.
Evidence or example (with explicit assumptions)
Below is a concrete example using the basic form without smoothing, and assuming:
- You use CurrentPrice = Close.
- You use the last N = 5 bars.
- You compute:
- HighestHigh(5) from the 5 most recent highs
- LowestLow(5) from the 5 most recent lows
Suppose over the last 5 bars you observe:
- HighestHigh(5) = 1.2000
- LowestLow(5) = 1.1800
- CurrentPrice (latest close) = 1.1950
Step 1: compute the denominator (range width):
- HighestHigh(5) − LowestLow(5) = 1.2000 − 1.1800 = 0.0200
Step 2: compute the numerator (distance from the bottom):
- CurrentPrice − LowestLow(5) = 1.1950 − 1.1800 = 0.0150
Step 3: scale:
- KR = 0.0150 / 0.0200 = 0.75
- SR = 100 × 0.75 = 75
So the Stochastic Range value indicates that the close sits about 75% of the way up the observed 5-bar high–low range.
One important exception: zero denominator
If HighestHigh(N) = LowestLow(N), the denominator becomes zero. This can happen when highs and lows are equal across the window (for example, during periods with no variation in the relevant inputs or due to data quirks).
In such cases, implementations typically:
- return a default (often 0 or missing), or
- define a special-case behavior.
When you verify your calculation, check how your chosen method handles this edge case.
Limitations and risks (what can break the result)
-
Window choice changes everything The lookback length N controls the high–low bounds. A longer N uses a broader range and often produces smoother, more stable scaling; a shorter N reacts faster but may be more sensitive to brief extremes.
-
Granularity affects the rolling range If you switch from daily bars to hourly bars, the highest high and lowest low over “N bars” refer to a different time span, so the computed values are not directly comparable.
-
Data quality and source consistency Since the calculation uses high and low extremes, minor differences in data feeds or bar construction can shift HighestHigh(N) and LowestLow(N), which shifts the oscillator value.
-
Variant definitions can make it look like a different indicator If one platform applies smoothing or uses a different “current” price, your computed Stochastic Range may differ even when the lookback length is the same.
-
No built-in predictive guarantee Even when the math is correct, the computed position within a historical range does not, by itself, guarantee future outcomes. Historical range structure can change, and the same Stochastic Range level can occur in very different market conditions.
Verification and next question to ask
To independently verify Stochastic Range:
- Confirm the exact implementation definition: N, which price is CurrentPrice, whether values are scaled to 0–1 or 0–100, and whether smoothing is used.
- Compute HighestHigh(N) and LowestLow(N) directly from your OHLC data.
- Recalculate the formula bar-by-bar and check the edge case where HighestHigh(N) − LowestLow(N) = 0.
If you want the next step, ask how the chosen settings (especially N and any smoothing) change the output. A common follow-up is: How do settings change stochastic range?