williams_r

Williams %R momentum oscillator

williams_r(period)

Parameters

Williams %R - williams_r(period)

A momentum oscillator that measures overbought and oversold conditions.

Similar to Stochastic %K but inverted and scaled to -100 to 0.

  • period (int): Number of periods for high-low range calculation
  • Common values: 14 (standard), 20, 50

Formula


Williams %R = -100 * (Highest High - Close) / (Highest High - Lowest Low)

Where:
- Highest High = Maximum high over period
- Lowest Low = Minimum low over period
- Close = Current closing price

Examples


williams_r(14);  # Standard 14-period Williams %R
williams_r(20);  # 20-period Williams %R
williams_r(14) > -20;  # Overbought condition
williams_r(14) < -80;  # Oversold condition

Returns

Williams %R value ranging from -100 (most oversold) to 0 (most overbought)