PINE LIBRARY
更新済

PackLib

167
PackLib — a generic price-row "pack" database for footprint and flow indicators.

What it does
PackLib gives you a reusable, memory-frugal way to store and query per-price-row volume data. A BucketPack indexes buy, sell and liquidation volume by price row, where row height is set by a rowTicks parameter and mapped to the chart via syminfo.mintick. It is the data backbone for footprint, volume-profile and liquidation-heatmap style scripts.

Why it exists
Building a row-bucketed flow store inline tends to allocate fresh arrays every tick, which exhausts memory on lower timeframes. PackLib solves this with a reuse-in-place pattern: you allocate one pack and one rolling profile once, then clear-and-refill them each bar. No per-tick allocation, bounded ring buffers, and guarded loops throughout.

How to use it
1. Import the library and allocate a var BucketPack with emptyPack().
2. Each bar, size it with resetPack(minRow, maxRow, rowTicks, src) or clearPack() when out of window.
3. Fill it with accumulateOhlcv() and accumulateLiqNorm() from your lower-timeframe arrays.
4. Read features with packVA() for value area, plus liquidation-normalisation and imbalance helpers.
5. For a stationary profile across recent bars, allocate a var RollingProfile with newRollingProfile(), call update() each bar, then rollingVA().

Notes
Row math (priceToTick, tickToRow, rowMid, rowLo, rowHi, rowForPrice) is stateless and rowTicks-parameterised, so the same pack works for any symbol or timeframe. The "src" field is an opaque caller-owned tag; channel meaning (volume, liquidations, or other data) is decided by the caller, making the framework reusable beyond any single indicator.

This is a library. It exports functions only and plots nothing on its own — import it into your indicator or strategy.
リリースノート
v2

Added:
packLiqCluster(p, side, rowTicks, shelfThreshold)
  Parameters:
    p (BucketPack)
    side (string)
    rowTicks (int)
    shelfThreshold (float)

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。