Williams Accumulation Distribution Williams AD Strategy
The Williams Accumulation/Distribution Indicator (Williams AD) is a technical analysis indicator that monitors price changes and trading volumes to determine market sentiment. This indicator is based on Williams'…

Overview
The Williams Accumulation/Distribution Indicator (Williams AD) is a technical analysis indicator that monitors price changes and trading volumes to determine market sentiment. This indicator is based on Williams' assumption that volume tends to increase in a falling market. It reflects whether the current market trend is controlled by buyers or sellers.
This strategy analyzes the changes in the values of the Williams Accumulation/Distribution indicator to determine whether the current trend is in an accumulation phase or a distribution phase, thereby generating buy and sell signals.
Strategy Logic
The core indicator of this strategy is the Williams Accumulation/Distribution (Williams AD). The calculation formula is as follows:
If Close > Previous Close
Williams AD = Previous Williams AD + (Close - Low)
If Close < Previous Close
Williams AD = Previous Williams AD + (Close - High)
If Close == Previous Close
Williams AD = Previous Williams AD
Where if today's close is higher than yesterday's, today's AD value is equal to yesterday's AD value plus the difference between "today's close - today's low". If today's close is lower than yesterday's, today's AD value is equal to yesterday's AD value plus the difference between "today's close - today's high".
This indicator reflects the power relationship in trading. The main judgment rules are as follows:
- Rising AD indicates increasing buying power, which is an accumulation trend.
- Falling AD indicates increasing selling power, which is a distribution trend.
When the security price hits a new high and the AD indicator does not hit a new high, it is considered a distribution signal to go short. When the security price hits a new low and the AD indicator does not hit a new low, it is considered an accumulation signal to go long.
According to these rules, the specific trading signal generation rules for this strategy are:
- AD > 0, generate long signal
- AD < 0, generate short signal
The long and short direction can be reversed through the input parameter "reverse".
Advantage Analysis
The advantages of this strategy include:
Using Williams AD to judge market sentiment can improve win rate.
The indicator calculation is simple and easy to implement.
The reverse parameter allows flexible adaptation to different market conditions.
Divergence between indicator and price can generate relatively accurate trading signals.
Market sentiment can be clearly visualized through candlestick colors.
Risk Analysis
This strategy also has the following risks:
Williams AD has lagging issues which may generate wrong signals.
Relying solely on one indicator can be affected by false breakouts and generate too frequent signals.
Improper parameter settings may lead to over-trading.
Other factors need to be considered to determine entry and exit timing.
Indicator judgements may be problematic around trend reversals.
Risks can be reduced through optimizing parameters, combining multiple indicators for confirmation, filtering trade frequency, etc.
Optimization Directions
This strategy can be optimized in the following aspects:
Add more parameters for optimization, such as trading range, frequency, etc.
Combine with other indicators for signal filtering, such as volume-price indicators, moving averages, etc.
Add stop loss strategies to control single trade loss.
Conduct parameter training to find optimal parameter combinations.
Incorporate machine learning algorithms for dynamic parameter optimization.
Test robustness across different products, timeframes, market environments.
Build backtesting system to evaluate strategy's risk-reward profile.
Conclusion
The Williams AD strategy judges market sentiment based on indicator direction changes. It has the advantages of simple signal generation and flexible parameter tuning. But as a single indicator strategy, it has inherent limitations and needs multi-dimensional optimizations and additional techniques for verification before stable profitability in live trading. It provides reference for judging market sentiment but still requires prudent trading.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | false | Trade reverse |
Source Pine Script
/*backtest
start: 2023-10-02 00:00:00
end: 2023-11-01 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 18/01/2018
// Accumulation is a term used to describe a market controlled by buyers;
// whereas distribution is defined by a market controlled by sellers.
// Williams recommends trading this indicator based on divergences:
//
// Distribution of the security is indicated when the security is making
// a new high and the A/D indicator is failing to make a new high. Sell.
//
// Accumulation of the security is indicated when the security is making
// a new low and the A/D indicator is failing to make a new low. Buy.
//
//You can change long to short in the Input Settings
//WARNING:
//- For purpose educate only
//- This script to change bars colors.
////////////////////////////////////////////////////////////
strategy(title="Williams Accumulation/Distribution (Williams AD)", shorttitle="Williams AD")
reverse = input(false, title="Trade reverse")
hline(0, color=blue, linestyle=line)
xPrice = close
xWAD = iff(close > nz(close[1], 0), nz(xWAD[1],0) + close - low[1],
iff(close < nz(close[1],0), nz(xWAD[1],0) + close - high[1],0))
pos = iff(xWAD > 0, 1,
iff(xWAD < 0, -1, nz(pos[1], 0)))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1, 1, pos))
if (possig == 1)
strategy.entry("Long", strategy.long)
if (possig == -1)
strategy.entry("Short", strategy.short)
barcolor(possig == -1 ? red: possig == 1 ? green : blue )
plot(xWAD, color=green, title="Williams AD")Published by ChaoZhang on the FMZ strategy square · last modified 2023-11-02. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Williams-Accumulation-Distribution-Williams-AD-Strategy.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- 5 Day Moving Average Channel Breakout Strategy Combined With Mileage ConceptPine Script · Breakout · 1d
- ATR Trailing Stops StrategyPine Script · Breakout · 1h
- ATR Trend Breakout StrategyPine Script · Breakout · 1d
- Adaptive Bollinger Breakout with Moving Average Quantitative Strategy SystemPine Script · Breakout · 1h
- Adaptive Channel Breakout StrategyPine Script · Breakout · 1d
- Adaptive Multi Period Trading Strategy Based on Wave Trend Momentum BreakoutPine Script · Breakout · 2h