PINE LIBRARY
تم تحديثه PackLib

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.
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.
ملاحظات الأخبار
v2Added:
packLiqCluster(p, side, rowTicks, shelfThreshold)
Parameters:
p (BucketPack)
side (string)
rowTicks (int)
shelfThreshold (float)
مكتبة باين
كمثال للقيم التي تتبناها TradingView، نشر المؤلف شيفرة باين كمكتبة مفتوحة المصدر بحيث يمكن لمبرمجي باين الآخرين من مجتمعنا استخدامه بحرية. تحياتنا للمؤلف! يمكنك استخدام هذه المكتبة بشكل خاص أو في منشورات أخرى مفتوحة المصدر، ولكن إعادة استخدام هذا الرمز في المنشورات تخضع لقواعد الموقع.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
مكتبة باين
كمثال للقيم التي تتبناها TradingView، نشر المؤلف شيفرة باين كمكتبة مفتوحة المصدر بحيث يمكن لمبرمجي باين الآخرين من مجتمعنا استخدامه بحرية. تحياتنا للمؤلف! يمكنك استخدام هذه المكتبة بشكل خاص أو في منشورات أخرى مفتوحة المصدر، ولكن إعادة استخدام هذا الرمز في المنشورات تخضع لقواعد الموقع.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.