Momentum OscillatorsPine Script v6

ta.wpr()Williams %R

Williams %R is a momentum indicator that measures overbought and oversold levels on a scale from -100 to 0.

Syntax

Syntax
ta.wpr(length) → series float

Arguments

ParameterTypeDescription
lengthseries intLookback length for the highest high and lowest low.

Returns

Williams %R.

Remarks

na values in the source series are ignored.

Code Examples

Pine Script v6 Example
//@version=6
indicator("ta.wpr")
plot(ta.wpr(14))

Trading Applications

Identify overbought (above -20) and oversold (below -80) conditions

Generate reversal signals at extreme levels

Confirm trend strength with sustained readings

Use divergences for early reversal detection

Related Functions

Frequently Asked Questions

ta.wpr(length) returns Williams %R using the chart high/low/close over the lookback window, scaled from -100 (weak) toward 0 (strong within the range).

Common conventions use roughly -20 for overbought and -80 for oversold, inverted versus many 0–100 oscillators because %R ranges -100 to 0.

They are related range-based momentum concepts; %R is typically inverted and scaled -100..0, while raw stochastic %K is often 0..100. Both compare close location within the period range.

Generate ta.wpr() Code with AI

Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.wpr() and other built-in functions instantly.