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

    Function anchoredVwap

    • Anchored VWAP — the volume-weighted average price of every bar from a chosen bar onwards, accumulated rather than windowed:

      ${output}[i] = Σ typicalPrice·volume / Σ volume     over bars anchor .. i
      typicalPrice = (high + low + close) / 3

      Appends one column, undefined on every bar before the anchor and defined from the anchor bar itself (where it is simply that bar's typical price). This is the VWAP of the execution desk: the average price actually traded since some event — an earnings print, a gap, a swing low — which is what a trader means by "we are above VWAP from the low".

      vwap ships the rolling form and its docstring names this one as the sibling it is not: a count window is emitted only once it spans period rows, so period = length gives one value at the last bar, not a running line. The two are genuinely different studies and this is the one with no window at all.

      The third form — VWAP that resets every session — is sessionVwap, which needed the session boundaries the trading calendar supplies ([PND-TCAL] / the corpus' G4) and now shares this study's kernel: it is this same accumulation re-anchored at every session open. What made this form shippable before the calendar was that its anchor is a user parameter, so no calendar is consulted.

      There is no default: the anchor is the whole study — "VWAP from where?" is the question a caller is answering — and every candidate default is a different indicator. The series start would be a cumulative-from-inception VWAP, which is dominated by ancient bars; the last bar would be a constant.

      It is a Date or epoch milliseconds rather than a row index, because that is what the caller actually has (the timestamp of the event they are anchoring to) and because a row index does not survive a filter, a join or a resample. The line starts at the first bar whose key is at or after anchor, so an anchor between two bars snaps forward to the next one and an anchor before the series covers the whole of it. An anchor after the last bar leaves the column entirely undefined — no bars qualify, and that is not an error.

      The key read is the key column's start (keyColumn().begin), so on a timeRange- or interval-keyed series the comparison is against each bar's beginning.

      typicalPriceValues for the price and anchoredVwapValues for the ratio of running sums. The only thing this study owns is the anchor: it builds a single anchor group (NaN before the anchor bar, one id from there on) and the kernel does the rest, with no arithmetic here at all. sessionVwap is the same call with each bar's session id in place of that one group — which is why the two studies share a kernel rather than a family resemblance.

      The denominator is blanked wherever the numerator is, before either is accumulated (in the kernel). That is not tidiness: a bar with a volume but a missing high would otherwise contribute to Σ volume and not to Σ price·volume, which is a VWAP quietly biased toward zero — the #710 rule (two accumulations of two columns must consume the same bars), pinned by a test.

      • An interior gap ENDS the line. Both sums are running sums, so a missing term makes every later level a known sum plus an unknown. That is obv's rule and the A/D line's, and it is right here for the same reason it is right there: the reading is a level, and skipping the bar would report an average price that silently excludes volume that traded. It is not negativeVolumeIndex's re-seed, which is for an index measured from an arbitrary base. A caller who needs continuity fills first, or re-anchors after the hole — sessionVwap, on the same kernel, re-anchors automatically at the next session open.
      • Zero cumulative volume → undefined. Reachable when the anchor falls on a run of zero-volume bars: there is nothing to weight by, so there is no average price — not 0, and not the plain mean of typical price. The guard is live and at the output; without it the reading would be ±Infinity, which withColumn rejects outright.
      • Scales with price, not with volume — doubling every price doubles it, doubling every volume leaves it unchanged, exactly as vwap does. Both are pinned as property tests.

      Type Parameters

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

      Parameters

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