Returns Williams %R: where the close sits in the last length bars' high-low range, from -100 to 0.
ta.wpr reads high, low and close from the chart. It computes 100 * (close - highestHigh) / (highestHigh - lowestLow) over length bars.
A close at the highest high gives 0, at the lowest low gives -100. It is the stochastic turned upside down and shifted. Output starts on bar number length.
Syntax
ta.wpr(length: series int) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| length | series int | required | Number of bars in the range. A whole number of 1 or more. |
Returns
series float: a value from -100 to 0, or na while the range window is not full.
Remarks
- Levels of -20 and -80 are the usual overbought and oversold marks.
Example
//@version=6
indicator("Williams %R")
plot(ta.wpr(14), "%R", color = color.fuchsia)
hline(-20)
hline(-80)See also
Runs on Sidechair