A/D Line with Adaptive Strength BandsThis indicator analyzes the Accumulation/Distribution (A/D) line using a normalized linear regression slope over a rolling lookback period that can adjust automatically to the chart timeframe. The A/D line is built from price and volume, with each bar contributing positive or negative money flow depending on where the close falls within the bar’s range. The script then smooths the A/D line with an EMA and applies a linear regression to estimate its underlying trend.
A key feature of the script is its adaptive lookback. In Auto mode, the regression length adjusts by timeframe so the indicator remains responsive on intraday charts, balanced on daily charts, and not overly slow on weekly or monthly charts. In Manual mode, the user can set a fixed lookback length.
Rather than using the raw regression slope alone, the script normalizes the slope by dividing it by the standard deviation of the smoothed A/D line over the same lookback window. This is important because the A/D line is cumulative, so its raw values can become very large and are not directly comparable across different stocks, sectors, or timeframes. A raw slope that appears meaningful on one chart may be insignificant on another simply because the scale of the A/D line is different.
Normalization solves that problem by expressing the trend relative to the A/D line’s own recent variability. In other words, it shows whether the current slope is strong or weak compared with that stock’s normal behavior. This makes the indicator more informative than a simple endpoint comparison and more useful for comparing the strength of accumulation or distribution across various stocks.
The output is classified into bands such as Strong Accumulation, Accumulation, Neutral, Distribution, and Strong Distribution. The A/D line and its EMA are plotted as thin reference lines, while the regression slope line is highlighted to make the dominant money-flow trend easier to see. The result is a cleaner visual tool for identifying improving or weakening accumulation/distribution and for comparing relative money-flow strength across different securities.
Pine Script® indicator






















