@rekurt/openkline - v0.2.0
    Preparing search index...

    Class OBV

    On-Balance Volume (Granville 1963) — cumulative volume tally that adds today's volume on up-closes and subtracts it on down-closes:

    OBV[0] = 0 OBV[i] = OBV[i-1] + v[i] if c[i] > c[i-1] OBV[i-1] - v[i] if c[i] < c[i-1] OBV[i-1] otherwise

    Single series in its own pane. The absolute value is rarely meaningful — what matters is the direction relative to price.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    placement: IndicatorPlacement = 'pane'

    Where the indicator renders (overlay vs. its own pane).

    priceScaleId?: PriceScaleSide

    Which price scale an overlay-placement indicator projects through (B2). 'right' (the default when undefined) is the primary scale shared with the price series; 'left' binds the indicator to the independent secondary scale, which the chart enables — reserving the left axis strip — only while at least one indicator requests it.

    Ignored for pane-placement indicators (they own their sub-pane axis). Subclasses opt in by overriding this getter (or declaring a matching readonly field).

    Accessors

    • get id(): string

      Stable human-readable identifier, e.g. sma(20) or rsi(14). Used as the cache key by the IndicatorRegistry and as a label in legends.

      Returns string

    Methods

    • Memoized wrapper around compute. Returns the same cached array reference while the SAME buffer's version and length are unchanged. The buffer identity is part of the key so reusing one indicator instance across two buffers (or swapping a chart's buffer) never returns another buffer's stale series — important right after init when distinct buffers can share version: 0 and the same length.

      When the data did change but only via a single realtime tick — an updateLast (same length) or one append (length + 1) on the SAME buffer with an unmoved head (firstTime unchanged) — and the subclass provides an updateTail hook, the tail is patched in O(tail) instead of recomputing the whole series in O(n). firstTime is part of the key precisely so a prepend/evictHead (which shifts the head and renumbers every index) can never be mistaken for an append/update and forces a full recompute.

      Use this on render paths; use compute directly to force a fresh computation.

      Parameters

      Returns IndicatorSeries[]

    • Incremental tail patch. OBV is cumulative: out[i] = out[i-1] ± volume[i] (sign from close[i] vs close[i-1]) The running tally up to index i-1 is exactly prev[i-1], and out[i-1] itself never changes under an updateLast (it depends only on candles ≤ i-1, none of which moved) nor under an append. So the single touched index is recomputed from prev[i-1] plus the current close[i]/close[i-1]/volume[i]. Index 0 is the cumulative origin (0).

      Parameters

      Returns IndicatorSeries[] | null