PROTECTED SOURCE SCRIPT

BTC OI Delta (binance, okx, bybit, htx, bitget, deribit)

27
📊 BTC Open Interest (OI) Delta (Binance, OKX, Bybit, HTX, Bitget, Deribit)

📝 Overview
This Pine Script indicator tracks and visualizes the changes (delta) in Bitcoin (BTC) open interest (OI) for perpetual futures across multiple major crypto exchanges: Binance, OKX, Bybit, Bitget, HTX, and Deribit. It calculates the total net delta by summing the OI delta from each exchange and displays positive (OI increase) and negative (OI decrease) deltas as separate column charts. Users can choose which exchanges to include or exclude and utilize the spike highlight feature to differentiate delta intensity with color based on user-defined thresholds.



⚡ Key Features

🌐 Multi-exchange OI delta tracking
Fetches and calculates BTC perpetual futures OI delta individually from Binance, OKX, Bybit, Bitget, HTX, and Deribit.

📈 Total net delta calculation
Sums the OI delta from all selected exchanges to represent overall market open interest changes.

🎨 Visualization
Column plots: Displays net OI increases (positive delta) and decreases (negative delta) as separate column charts for intuitive trend analysis.

Spike highlights: Changes in OI delta are color-coded according to user-defined thresholds to make significant moves easily identifiable.



⚙️ User settings
Users can select which exchanges to display, enable/disable spike highlights, and set thresholds for “strong” and “very strong” OI delta changes.

🛠 Input Settings
  • Show Zero Line (bool, default: true): Show a zero baseline on the chart.
  • Highlight Spikes (bool, default: true): Enable color highlighting based on OI delta intensity.
  • Strong Threshold (int, default: 1000): Delta value considered a “strong” change (in BTC).
  • Very Strong Threshold (int, default: 2000): Delta value considered a “very strong” change (in BTC).


  • Show Binance (bool, default: true): Include Binance OI delta.
  • Show OKX (bool, default: true): Include OKX OI delta.
  • Show Bybit (bool, default: true): Include Bybit OI delta.
  • Show Bitget (bool, default: true): Include Bitget OI delta.
  • Show HTX (bool, default: true): Include HTX OI delta.
  • Show Deribit (bool, default: true): Include Deribit OI delta.




🔢 Calculation Method

🧮 Individual OI request
Uses request.security() to fetch OI data from each exchange.

➕ Delta calculation
Current bar OI minus previous bar OI (oi - oi[1]).

❌ Handling na values
If OI data is missing (exchange disabled or no data), the delta is treated as 0 to avoid sum errors.

🔗 Total net delta
Sums all selected exchange deltas as totalCombinedDelta.
↔️ Separate net increase/decrease
Positive (netIncreaseCombined) and negative (netDecreaseCombined) parts of total delta are split.

🎨 Color determination
getNetDeltaHighlightedColor function dynamically sets column colors based on highlightSpike and threshold settings.

🎨 Color Scheme
  • Highlight disabled:
  • Positive delta: teal shades
  • Negative delta: red shades


Highlight enabled:
  • Positive delta (normal): dark teal (#026628)
  • Positive delta (strong): bright teal (#00ff95)
  • Positive delta (very strong): yellow (#eeff00)
  • Negative delta (normal): dark red (#6b0d0d)
  • Negative delta (strong): bright red (#ff1044)
  • Negative delta (very strong): pink (#ff00ea)




📊 Usage

💹 Market sentiment analysis
Total net OI delta increase → capital inflow and position building
Total net OI delta decrease → capital outflow and position liquidation

⚖️ Position interpretation
  • BTC rising + positive OI delta → increasing long positions
  • BTC falling + negative OI delta → decreasing long positions
  • BTC falling + positive OI delta → increasing short positions
  • BTC rising + negative OI delta → decreasing short positions


📈 Trend confirmation
  • Sustained positive delta → bullish signal
  • Sustained negative delta → bearish signal


🌪 Volatility prediction
“Strong” or “very strong” spikes may indicate increased price volatility.

🏦 Exchange-specific impact
Enable/disable exchanges to analyze how each exchange’s OI changes affect the overall market.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.