Indicators/probuilder · probacktest · proorder · proscreener

WilliamsAccumDistr

WilliamsAccumDistr in ProBuilder returns the Williams Accumulation Distribution line, measuring buying and selling pressure. Syntax, formula, examples.

Syntax

probuilder
WilliamsAccumDistr(price)

Parameters

NameTypeDefaultDescription
priceprice sourcecloseThe series used to compare consecutive closes. The conventional input is close.

There is no period argument. The line is cumulative over the whole visible history.

Formula

For each bar:

code
TRH = MAX(close[1], high)      // true range high
TRL = MIN(close[1], low)       // true range low

IF close > close[1] THEN  AD = close - TRL
IF close < close[1] THEN  AD = close - TRH
IF close = close[1] THEN  AD = 0

WilliamsAccumDistr = previous WilliamsAccumDistr + AD

Up closes add a positive amount (distance from the true range low), down closes add a negative amount (distance from the true range high), and unchanged closes add nothing.

How it works

The indicator asks a simple question on every bar: did the market close nearer the top or the bottom of its true range, and in which direction did the close move. When the close rises, the bar is treated as accumulation and the distance between the close and the true range low is added to the running total. When the close falls, the bar is treated as distribution and the distance from the true range high is subtracted. Using true range (which incorporates the prior close) means gaps are counted rather than ignored.

The absolute level of the line is not meaningful, it depends on how much history is loaded. What matters is its direction and, above all, how that direction compares with price. This differs from AccumDistr, which weights each bar by volume and close position within the bar's own range, and from OBV, which adds or subtracts the entire bar volume based on close direction. WilliamsAccumDistr uses no volume at all, only price geometry.

Examples

Example 1, Bullish and bearish pressure counters (Indicator)

probuilder
// Track whether the accumulation line is above or below zero
i1 = WilliamsAccumDistr(close)
bullish = 0
bearish = 0
IF(i1 > 0) THEN
  // Net accumulation since the start of the data
  bullish = bullish + 1
  bearish = bearish - 1
ELSIF(i1 < 0) THEN
  // Net distribution since the start of the data
  bullish = bullish - 1
  bearish = bearish + 1
ENDIF
RETURN bullish, bearish

The source example, with rewritten comments. It converts the sign of the line into two simple counters that can feed other logic.

Example 2, Divergence check against price (Indicator)

probuilder
// Compare 20-bar direction of price and the accumulation line
wad = WilliamsAccumDistr(close)
priceUp = close > close[20]
wadUp = wad > wad[20]

IF priceUp AND NOT wadUp THEN
  signal = -1   // price rising while accumulation falls, bearish divergence
ELSIF wadUp AND NOT priceUp THEN
  signal = 1    // accumulation rising while price falls, bullish divergence
ELSE
  signal = 0
ENDIF
RETURN signal AS "WAD divergence"

Flags bars where the 20-bar direction of the accumulation line disagrees with the 20-bar direction of price, the standard divergence use of this indicator.

Example 3, Exit filter when accumulation stalls (ProOrder)

probuilder
// Close longs when the accumulation line stops rising
wad = WilliamsAccumDistr(close)
trend = Average[50](close)

IF NOT LongOnMarket THEN
  IF close > trend AND wad > wad[10] THEN
    BUY 1 CONTRACT AT MARKET
  ENDIF
ELSE
  IF wad < wad[10] THEN
    SELL AT MARKET
  ENDIF
ENDIF

Requires the accumulation line to be higher than ten bars ago before entering long, and exits when that condition flips, using the line as a pressure gauge around a trend filter.

Interpretation

A rising line indicates that up closes are consistently claiming more of the true range than down closes, net buying pressure. A falling line indicates the opposite.

The primary signal is divergence. When price makes a lower low but the line makes a higher low, buying pressure is building beneath the surface, a bullish divergence. When price makes a higher high but the line makes a lower high, the advance lacks pressure behind it, a bearish divergence. Divergences describe conditions rather than timing, so they are usually paired with a trigger such as a moving average cross or a range breakout.

Common errors and gotchas

  • Adding a period argument. WilliamsAccumDistr[14](close) is invalid. The instruction takes only a price in parentheses and accumulates over all loaded bars.
  • Comparing levels across charts. The absolute value depends on the amount of history loaded, so a reading of 500 on one chart and 5000 on another says nothing comparable. Compare slopes and divergences, not levels.
  • Expecting volume sensitivity. Despite the name, this indicator uses no volume. For volume-weighted accumulation use AccumDistr, OBV, or ChaikinOsc.
  • Confusing it with Williams. Williams is the %R range oscillator, a different indicator by the same author. The two share nothing beyond the name.
  • AccumDistr, volume-weighted accumulation distribution line.
  • OBV, on-balance volume, cumulative signed volume.
  • MoneyFlow, bounded measure of buying and selling pressure.
  • MoneyFlowIndex, volume-weighted RSI-style oscillator.
  • ChaikinOsc, oscillator built on the accumulation distribution line.
  • PVT, price volume trend, volume scaled by percentage change.
  • ForceIndex, price change multiplied by volume.
  • Williams, the %R oscillator from the same author.