Investment Studio > Expressions > Functions > Indicator > WAD
float array[*][2] wad(float array[*][4] dhlc, float start_wad = 0)
Returns a two-column array containing dates (first column) and corresponding Williams' Accumulation/Distribution (WAD) values (second column). Given n input rows in dhlc, n 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.
start_wad is the value returned for the start date (first input date), and the start value for the computation of all subsequent output values. If omitted, it defaults to 0.
WAD is defined as a cumulative sum: if the day's close is higher than the previous close,
WAD = previous WAD + close - min(low, previous close)
while if the day's close is lower than the previous close,
WAD = previous WAV + close - max(high, previous close)
start_wad therefore acts as an overall offset, and is important only if WAD values need to be compared across different assets or date ranges.
Interpretation
WAD is a cumulative velocity indicator. As such, it tends to follow price closely. Signals are generated when this close relation breaks down: price setting a new high and WAD failing to do the same is a bearish divergence (sell signal), price setting a new low and WAD failing to do the same is a bullish divergence (buy signal).
For a real life example, consider the Dow Jones Industrials (DJIA) in the period 1998-2000:

Note the divergences at the major price tops in July 1998, August 1999 (where WAD was busy completing a classic head-and-shoulders) and in January 2000.
Example
Assuming standard US date format settings,
=wad({{"1/1/1990", 100, 90, 98}, {"1/2/1990", 97, 84, 86}})
returns {{32874, 0}, {32875, -12}}. 32874 is the date code for 1/1/1990; 0 is the WAD value for that date (= the default start_wad). 32875 is the date code for 1/2/1990; -12 = 0 + 86 - max(97, 98) is the WAD for that date, since the close was lower than the previous close.