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

    Function computeVolumeProfile

    • C4 — Volume Profile. Bin the volume of every candle in view across the price range [priceMin, priceMax], split into bins equal-width intervals.

      Distribution model: each candle's volume is spread over the bins its [low, high] range overlaps, proportionally to the overlap length — a candle spanning three bins evenly contributes a third of its volume to each; one whose range covers only the top half of a bin contributes only that fraction. A candle with low == high (or whose range collapses to a point after clamping) drops its whole volume into the single bin containing that price. Volume of candles entirely outside [priceMin, priceMax] is clamped to the nearest edge bin (so an off-range bar still counts toward totalVolume rather than silently vanishing).

      pocIndex is the highest-volume bin. The value area is the smallest set of contiguous bins around the POC whose summed volume reaches valueAreaPct (default 0.70) of totalVolume, grown one bin at a time toward whichever adjacent side holds more volume — the standard market-profile expansion. Its price extent is returned as valueAreaLow/valueAreaHigh.

      NaN-safe: candles with a non-finite low, high, or volume, or non-positive volume, are skipped. A degenerate request (bins < 1, a non-finite or inverted price range) yields a single empty bin spanning the (repaired) range with pocIndex = -1. Pure; allocates only the result.

      Parameters

      • view: CandleView
      • bins: number
      • priceMin: number
      • priceMax: number
      • Optionalopts: { valueAreaPct?: number }

      Returns VolumeProfile