@pond-ts/financial API Reference
    Preparing search index...

    Function accumulationDistribution

    • Accumulation/Distribution line (Marc Chaikin) — a running total of each bar's volume signed by where in its own range it closed:

      CLV[i] = ((close − low) − (high − close)) / (high − low)      in [−1, +1]
      AD[i] = AD[i−1] + CLV[i] · volume[i]

      The obv idea with a finer signal. OBV counts a bar's whole volume as buying or selling on the sign of the close change alone; A/D grades it by the close's position in the bar, so a bar that rallies and gives it all back contributes little in either direction. Like OBV the level is arbitrary — the line is read for its slope and for divergence against price — so this study has no period: there is nothing to size a window over.

      Appends one column, defined from the first bar: A/D's term needs only the bar itself (no previous close), so unlike OBV there is not even a seeding convention to pick.

      Both halves live in kernels — clvValues derives the per-bar location, cumulativeValues accumulates — and the composed accumulationDistributionValues is what chaikinOscillator smooths, so the two studies read one array rather than two derivations.

      High, low, close and volume, each named by an option defaulting to its DEFAULT_OHLCV name — the atr rule, applied once more.

      TA-Lib's AD, exactly on gap-free bars with a range: cross-checked bar-for-bar in the oracle fixture (delta 0, and an identical — empty — warm-up mask). No period, so there is one case rather than two.

      • A leading gap in any input shifts the seed to the first bar where all four are present, which is what lets the line run over another study's output rather than come back empty (obv's rule).
      • An interior gap propagates to the end. Every level after an unknown term is unknown; skipping it would report a level silently off by the missing contribution for the rest of the series. Fill before running if you need continuity.
      • A flat bar (high === low) contributes 0 and the line carries on — the close location's numerator is exactly zero there, so this is the value, not a convention (clvValues). It is also what TA-Lib's AD does (measured on twelve bars with bar 3 flattened: [0, 100, 100, 100, 100, 400, …, 1900]), so the two agree on every bar, halts included. Only a missing price is a gap.
      • Scale behaviour: linear in volume, and invariant under any affine change of price — scaling or shifting every price leaves the close location, and so the line, unchanged. Both pinned by property tests.

      Type Parameters

      • S extends SeriesSchema
      • const Output extends string = "ad"

      Parameters

      Returns TimeSeries<
          readonly [S[0], ValueColumnsForSchema<S>, OptionalNumberColumn<Output>],
      >