WILLIAMSR (Williams %R)
Williams %R is a fast momentum oscillator that shows the current closing price relative to the high-low range over a period. It ranges from -100 (oversold) to 0 (overbought).
Declaration
function init(ctx) { ctx.indicator('willr', 'WILLIAMSR', { period: 14 }); }
Options
| Option | Type | Default | Description |
|---|---|---|---|
period | number | 14 | Lookback period |
Output
Returns a single number[] series with values between -100 and 0.
Accessing Values
function onBar(ctx, i) { const willr = ctx.ind.willr[i]; }
Use Cases
Reversal Trading
function onBar(ctx, i) { const willr = ctx.ind.willr[i]; if (willr < -80) { ctx.order.market('ASSET', 1, { signal: 'buy', reason: 'willr_oversold' }); } if (willr > -20) { ctx.order.close('ASSET', { signal: 'sell', reason: 'willr_overbought' }); } }
Value Ranges
| Range | Interpretation |
|---|---|
| -100 to -80 | Oversold |
| -80 to -20 | Neutral |
| -20 to 0 | Overbought |
Calculation
$$%R = \frac{Highest High - Close}{Highest High - Lowest Low} \times -100$$
Related
indicatorwilliamsrwilliamsmomentumoscillatorqsl