Investment Studio > Expressions > Functions > Indicator > WRO
float array[*][2] wro(float array[*][4] dhlc, integer days)
Returns a two-column array containing dates (first column) and corresponding Williams' %R Oscillator (WRO) values (second column). Given n input rows in dhlc, n - days + 1 rows are returned.
dhlc is a four-column array containing daily price quotes. Each row is structured as follows:
| Column # | Content |
| 1 | The quote date. |
| 2 | The day's high (highest traded price). |
| 3 | The day's low (lowest traded price). |
| 4 | The day's close (last traded price). |
The array is assumed to be time-sorted, with earlier dates preceding later dates.
Automatic type conversion allows the use of date strings as arguments instead of explicit date values.
days > 0 sets the timescale of the WRO, i.e. the number of trading days over which each day's WRO is computed.
Interpretation
Willaims' %R is a price trend indicator closely related to the more popular STO. It's based on the observation that prices tend to end near recent highs in an uptrend, near recent lows in a downtrend:
| today's close - highest recent high | |
| %R = 100 | ¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾¾ |
| highest recent high - lowest recent low |
This is simply the position of the day's close relative to the recent price range, expressed as a percentage. %R = 0 means that the day closed at (and presumably set) the highest recent high; all other closes yield a negative %R. The lowest possible value is -100, meaning that the day closed at (and presumably set) the lowest recent low. Values above -50 mean that the day's close was in the upper half of the recent price range, implying an uptrend; values below -50 mean that the day's close was in the lower half of the recent price range, implying a downtrend.
The exact meaning of "recent" is determined by the days argument; a value of 10 would mean that the latest 10 trading days (including the current one) are considered.
A comparison of the definition of %R with the definition of %K (raw stochastics) shows that they are essentially the same. The only difference is the choice of reference point: %R uses the highest recent high, %K uses the lowest recent low, so %R = %K - 100. The information contained in the two quantities is therefore identical, and the same interpretation applies. You can look for overbought conditions (%R values over -25 or -20, depending on whom you ask) and oversold conditions (%R values under -75 or -80); you can create the equivalents of fast and slow stochastics using MA or EMA and look for crossovers; and you can look for divergences between %R and price. See STO for details.
For a real life example, consider Dell (NASD:DELL) from January 1 to December 31, 2001:

The top chart shows the price in standard candlestick form. The bottom chart shows %K (raw stochastics) in gray and Williams' %R in red, both computed over ten days. As expected, the only difference between them is a vertical offset.
Example
Assuming standard US date format settings,
=wro({{"1/1/1990", 100, 90, 98}, {"1/2/1990", 97, 84, 86}, 2)
returns {{32875, -87.5}}. 32875 is the date code for 1/2/1990; -87.5 is the 2 day %R on that date.