Williams Percent Range (%R) determines whether the market is overbought/oversold. Williams %R is very similar to the Stochastic Oscillator. The only difference is that %R has an upside down scale and the Stochastic Oscillator has internal smoothing. In the chart below you can see that the plots are identical but they are plotted on different scales.
x is the period which must be an integer.
y is the period of an optional simple moving average which can be applied to the Williams %R.
z is the offset. An offset of 1 returns the value from the previous bar instead of the current bar.