Mechanism and definition of Stochastic Range
Stochastic Range is a descriptive calculation that expresses where a selected “current” price lies inside a recent price interval defined by a highest high and a lowest low over a lookback window.
A common mathematical form is:
- Let H be the highest price in the lookback window (e.g., highest high).
- Let L be the lowest price in the lookback window (e.g., lowest low).
- Let C be the current price you want to locate within that range (often the latest close).
- Then the Stochastic Range value is: SR = (C − L) / (H − L) × 100
Interpretation (purely descriptive):
- SR = 0 means C equals L (at the bottom of the recent range).
- SR = 100 means C equals H (at the top of the recent range).
- Values between 0 and 100 place C proportionally within the interval.
If H − L = 0 (no variation inside the lookback), SR is undefined because you would divide by zero; in practice that case must be handled explicitly.
Worked numerical example with explicit assumptions
Assume a data window of 5 bars. We will use high and low extremes from those bars, and we will use the latest close as C.
Assumptions (fixed for this example):
- Lookback window length = 5 bars.
- H is the maximum of the 5 bars’ highs.
- L is the minimum of the 5 bars’ lows.
- C is the close of the next (current) bar.
- No fees, financing, or slippage are modeled because SR is a location statistic computed from prices.
Hypothetical inputs (currency prices, any units):
- Over the lookback window:
- Highest high (H) = 1.2100
- Lowest low (L) = 1.2000
- Current close (C) = 1.2050
Step-by-step calculation:
- Compute the range width: H − L = 1.2100 − 1.2000 = 0.0100
- Compute how far C is above L: C − L = 1.2050 − 1.2000 = 0.0050
- Convert to a 0–100 scale:
- SR = (0.0050 / 0.0100) × 100 = 50
Result: Stochastic Range = 50. Under these assumptions, the current close is exactly halfway between the chosen recent low and high.
Limitations, risks, and failure modes you can verify
- Lookback choice changes the value. If you change the window length, the computed H and L can shift, so SR can move even if the current price stays the same.
- Data source and price type matter. Using highs/lows from different feeds, or using close vs. another price for C, can produce different SR values. Two providers can compute “the current price” differently (e.g., last traded vs. latest completed bar), which affects C.
- Degenerate window (H = L) breaks the calculation. In a flat window, H − L = 0, making SR undefined unless your implementation defines a fallback. That is a concrete failure mode you can test.
- SR is descriptive, not predictive. Even if SR is high or low, that describes where price sits in a past interval; it does not, by itself, establish future direction. Historical location does not guarantee forward behavior.
- Costs and execution are not included. Because SR is computed from price levels without modeling transaction costs or execution effects, any attempt to connect it to real results must account for spreads, commissions, and slippage using separate data and assumptions.
Verification and next question to answer independently
To verify your understanding, replicate the calculation on a small set of bars using your chosen rule definitions for H, L, and C, then check that SR scales from 0 to 100 as C moves within the window. If you want deeper clarity, confirm whether your intended Stochastic Range definition uses the same price fields (high/low/close) and the same lookback length as in your example; those two choices dominate the output.