Guides, manuals and platform references.
Williams %R reads -15 while stochastic reads 85. That can be exactly the same observation wearing a different number. With the same price bars, lookback and close source, Williams %R equals raw fast stochastic %K minus 100. The important word is raw: a smoothed stochastic line need not match.
This matters in TradingView automation because two apparently agreeing indicators may be repeating one calculation. If you use AlgoWay to automate TradingView alerts, decide whether your rule needs two independent conditions or simply one range-position event. Changing the label on a signal does not add evidence to it.
Let H be the highest high over your chosen lookback, L the lowest low over that same window, and C the current close. Assume H is greater than L. The unsmoothed calculations are:
Raw fast %K = 100 × (C - L) / (H - L)
Williams %R = -100 × (H - C) / (H - L)
= raw fast %K - 100
The formulas follow TradingView's Williams %R documentation and the unsmoothed part of its stochastic calculation. The identity above is algebra: subtracting 100 from the first expression gives the second. It is a vertical shift, not a reversal of direction. When raw %K rises, %R rises too, becoming less negative.
For an illustrative window with H = 110 and L = 90, the range is 20 price units:
| Current close | Raw fast %K | Williams %R |
|---|---|---|
| 90 | 0 | -100 |
| 94 | 20 | -80 |
| 100 | 50 | -50 |
| 106 | 80 | -20 |
| 107 | 85 | -15 |
| 110 | 100 | 0 |
These are alternative closes within one fixed example range, not a backtest. At 107, the close is 85% of the way up from the low and 15% of the range below the high. Neither reading says the next price must fall. Conventional “overbought” labels describe location; they do not supply a timetable for reversal.
TradingView's stochastic indicator applies an SMA controlled by its Smooth input to the raw calculation, then calculates %D as an SMA of %K. Its documented default Smooth value is 3; setting it to 1 disables that additional %K smoothing. Comparing ordinary Williams %R with a three-bar-smoothed %K is therefore comparing different series.
Suppose three consecutive raw %K observations are 30, 60 and 90. Their three-value average is 60. Current raw Williams %R is -10, while the smoothed stochastic value minus 100 is -40. There is no contradiction: one uses today's range position; the other averages three observations. A %D crossover is another rule again, because it compares two lines rather than a line with a fixed threshold.
Before investigating a discrepancy, match the symbol and feed, timeframe, session, lookback window, source and completed bar. Check whether the stochastic plot is raw %K, smoothed %K or %D. Williams %R's documented source defaults to Close; a changed source also breaks this particular close-based comparison.
If H equals L, the displayed formulas divide by zero. A custom script should handle that case explicitly and avoid treating an undefined value as an entry. Display rounding can also make two values look equal at a threshold when their underlying values differ.
Under the matched raw calculations, %R crossing upward through -80 is the same event as %K crossing upward through 20. A precise completed-bar rule could be:
Previous %R <= -80 and current %R > -80
Equivalent: previous raw %K <= 20 and current raw %K > 20
By contrast, “%R is above -80” is a continuing state. It can remain true for many bars. Treating that state as a fresh entry on every evaluation produces a different strategy from acting once on the crossing. Decide how equality, missing values and evaluation timing work before constructing the alert.
Similarly, requiring both raw %K above 80 and matched %R above -20 adds no independent confirmation. They are the same inequality. Two thermometers with different scales do not make the room warmer.
If your aim is merely to identify a close near the top or bottom of its recent range, choose the scale you find easier to read. If you want smoothing, specify it and accept that the event may change. If you want additional evidence, identify a genuinely different measurement and test whether it helps; do not count a translated duplicate twice.
This equivalence does not extend to Stochastic RSI versus RSI. That indicator locates RSI within its own recent range, rather than locating price within a high-low range. Before wiring an oscillator into automated orders, write down the exact series and crossing rule. A familiar indicator name is not a complete instruction.