PROTECTED SOURCE SCRIPT
Aggregated StatBars

Coyote Stat Bars — a 4-row heatmap footprint that shows you Volume, Delta, OI Change, and Net Positioning on every bar, aggregated across Binance and Bybit perpetual futures.
Instead of switching between multiple indicators, Stat Bars gives you one compact view of all four order flow metrics. Each row is a color-coded heatmap cell — dim when noise, bright when significant. You see the full picture at a glance.
== HOW IT WORKS ==
Four rows, aligned per bar:
VOL — Total volume in USD. Blue heatmap scales with magnitude.
DELTA — Net aggressive buying vs selling (real volume delta, not candle color). Green = buyers aggressive, Red = sellers aggressive.
OI — Open Interest change. Green = new contracts opened, Red = contracts closed/liquidated.
POS — Net Positioning state derived from Delta + OI:
NL (New Longs) — Delta positive + OI increasing = fresh buyers entering
NS (New Shorts) — Delta negative + OI increasing = fresh sellers entering
LC (Longs Closing) — Delta negative + OI decreasing = longs exiting or liquidated
SC (Shorts Closing) — Delta positive + OI decreasing = shorts covering or squeezed
The positioning row uses a significance threshold — only bars with unusually large OI changes get vivid colors. Normal bars are dimmed so the important events stand out.
== DATA SOURCES ==
OI is aggregated across up to 5 sources:
- Binance USDT Perpetual OI
- Binance USD (coin-margined) Perpetual OI
- Bybit USDT Perpetual OI
- Bybit USD (inverse) Perpetual OI
- OKX USDT Perpetual OI (optional)
Coin-margined OI (denominated in base currency) is automatically normalized to USDT-equivalent for accurate aggregation.
Volume Delta uses TradingView's built-in lower-timeframe trade classification — this classifies trades by aggressor side (market orders hitting bids vs asks), not by candle color. This is critical because candle color lies on SFP bars: a sweep up + close down shows a red candle, but delta is positive (shorts buying to cover). Delta tells the truth.
== HEATMAP MODES ==
Adaptive (default):
Auto-adjusts thresholds using SMA + STDEV of each metric. Normal bars are nearly invisible, only extreme values pop with bright color. The non-linear intensity curve (squared) pushes noise very dim and creates dramatic contrast on significant events.
Fixed:
User-defined USD thresholds for each row (in millions). Useful if you prefer consistent reference points across sessions.
== DISPLAY OPTIONS ==
- Show/hide each row independently (VOL, DELTA, OI, POS)
- Text Mode: Auto (hides values when zoomed out), Full (always show), Hidden (color-only heatmap)
- Configurable text size and max bars displayed
- Row labels on the right side for quick reference
== POSITIONING SIGNIFICANCE ==
The positioning row has its own adaptive threshold system:
- SMA of absolute OI change over a configurable lookback (default 300 bars)
- Multiplied by a threshold multiplier (default 3.0)
- Bars exceeding this threshold get vivid positioning colors
- Bars below are dimmed — reducing noise, highlighting what matters
This means you're not just seeing "what happened" on every bar, you're seeing "what happened that actually mattered."
== BEST TIMEFRAMES ==
Works on any timeframe where OI data is available (typically 1m to 1D on crypto perpetuals). Most useful on 5m, 15m, 1H for intraday trading. The adaptive heatmap auto-adjusts to your timeframe.
== HOW TO USE ==
1. Add to your chart below the price panel
2. Scan the POS row for clusters of NL or NS with vivid colors — these are significant new positioning events
3. Cross-reference with the VOL and DELTA rows — a bright NL bar with high volume and strong positive delta is high-conviction new longs
4. Watch for LC/SC clusters with high OI decrease — these are liquidation or stop-out events
5. When all four rows align (high volume + strong delta + large OI change + clear positioning), you have maximum confluence
== ALERTS ==
- Significant New Longs — large OI increase + positive delta
- Significant New Shorts — large OI increase + negative delta
- Volume Spike — volume exceeds adaptive threshold
== NOTES ==
- Requires symbols with OI data (crypto perpetual futures on Binance, Bybit, OKX)
- Uses 6 request.security() calls for OI data + 1 for volume delta
- Maximum 125 bars displayed (500 boxes / 4 rows)
- Auto-detects the base currency from your chart symbol
Instead of switching between multiple indicators, Stat Bars gives you one compact view of all four order flow metrics. Each row is a color-coded heatmap cell — dim when noise, bright when significant. You see the full picture at a glance.
== HOW IT WORKS ==
Four rows, aligned per bar:
VOL — Total volume in USD. Blue heatmap scales with magnitude.
DELTA — Net aggressive buying vs selling (real volume delta, not candle color). Green = buyers aggressive, Red = sellers aggressive.
OI — Open Interest change. Green = new contracts opened, Red = contracts closed/liquidated.
POS — Net Positioning state derived from Delta + OI:
NL (New Longs) — Delta positive + OI increasing = fresh buyers entering
NS (New Shorts) — Delta negative + OI increasing = fresh sellers entering
LC (Longs Closing) — Delta negative + OI decreasing = longs exiting or liquidated
SC (Shorts Closing) — Delta positive + OI decreasing = shorts covering or squeezed
The positioning row uses a significance threshold — only bars with unusually large OI changes get vivid colors. Normal bars are dimmed so the important events stand out.
== DATA SOURCES ==
OI is aggregated across up to 5 sources:
- Binance USDT Perpetual OI
- Binance USD (coin-margined) Perpetual OI
- Bybit USDT Perpetual OI
- Bybit USD (inverse) Perpetual OI
- OKX USDT Perpetual OI (optional)
Coin-margined OI (denominated in base currency) is automatically normalized to USDT-equivalent for accurate aggregation.
Volume Delta uses TradingView's built-in lower-timeframe trade classification — this classifies trades by aggressor side (market orders hitting bids vs asks), not by candle color. This is critical because candle color lies on SFP bars: a sweep up + close down shows a red candle, but delta is positive (shorts buying to cover). Delta tells the truth.
== HEATMAP MODES ==
Adaptive (default):
Auto-adjusts thresholds using SMA + STDEV of each metric. Normal bars are nearly invisible, only extreme values pop with bright color. The non-linear intensity curve (squared) pushes noise very dim and creates dramatic contrast on significant events.
Fixed:
User-defined USD thresholds for each row (in millions). Useful if you prefer consistent reference points across sessions.
== DISPLAY OPTIONS ==
- Show/hide each row independently (VOL, DELTA, OI, POS)
- Text Mode: Auto (hides values when zoomed out), Full (always show), Hidden (color-only heatmap)
- Configurable text size and max bars displayed
- Row labels on the right side for quick reference
== POSITIONING SIGNIFICANCE ==
The positioning row has its own adaptive threshold system:
- SMA of absolute OI change over a configurable lookback (default 300 bars)
- Multiplied by a threshold multiplier (default 3.0)
- Bars exceeding this threshold get vivid positioning colors
- Bars below are dimmed — reducing noise, highlighting what matters
This means you're not just seeing "what happened" on every bar, you're seeing "what happened that actually mattered."
== BEST TIMEFRAMES ==
Works on any timeframe where OI data is available (typically 1m to 1D on crypto perpetuals). Most useful on 5m, 15m, 1H for intraday trading. The adaptive heatmap auto-adjusts to your timeframe.
== HOW TO USE ==
1. Add to your chart below the price panel
2. Scan the POS row for clusters of NL or NS with vivid colors — these are significant new positioning events
3. Cross-reference with the VOL and DELTA rows — a bright NL bar with high volume and strong positive delta is high-conviction new longs
4. Watch for LC/SC clusters with high OI decrease — these are liquidation or stop-out events
5. When all four rows align (high volume + strong delta + large OI change + clear positioning), you have maximum confluence
== ALERTS ==
- Significant New Longs — large OI increase + positive delta
- Significant New Shorts — large OI increase + negative delta
- Volume Spike — volume exceeds adaptive threshold
== NOTES ==
- Requires symbols with OI data (crypto perpetual futures on Binance, Bybit, OKX)
- Uses 6 request.security() calls for OI data + 1 for volume delta
- Maximum 125 bars displayed (500 boxes / 4 rows)
- Auto-detects the base currency from your chart symbol
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể sử dụng tự do và không giới hạn – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể sử dụng tự do và không giới hạn – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.