Sidechair

ta.wpr()

Browse the reference

Returns Williams %R: where the close sits in the last length bars' high-low range, from -100 to 0.

Try it in the editor

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

Pine Script
ta.wpr(length: series int) -> series float

Arguments

NameTypeDefaultDescription
lengthseries intrequiredNumber 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

Pine ScriptWilliams %ROpen in editor
//@version=6
indicator("Williams %R")
plot(ta.wpr(14), "%R", color = color.fuchsia)
hline(-20)
hline(-80)

See also

Runs on Sidechair