williams_r

Williams %R momentum oscillator

williams_r(period)

Parameters

Name Type Description
period int Number of periods for high-low range calculation

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) ## References - TradingView: `ta.wpr()` - Developed by Larry Williams ## Notes - Values > -20 indicate overbought conditions - Values < -80 indicate oversold conditions - Inverted scale compared to Stochastic (0 is top, -100 is bottom) - Returns -50 when range is zero (avoid division by zero)