OPEN-SOURCE SCRIPT
Open Interest Spaghetti - Multi Exchange

Open Interest Spaghetti – Multi Exchange is a structural open-interest flow visualizer designed to expose where and when derivatives positioning is being built or unwound across major futures venues — without collapsing that information into a single, opaque aggregate line.
Instead of smoothing, normalizing, or trend-filtering open interest, this script intentionally preserves exchange-level granularity and plots each venue’s cumulative OI delta from a shared anchor point. The result is a “spaghetti” structure: multiple independent OI paths evolving in parallel, revealing divergence, dominance, and regime shifts in real time.
Core Idea and Originality
Most OI indicators do one of three things:
1) Plot raw open interest (slow, hard to interpret),
2) Plot OI change per bar (noisy, context-less),
3) Aggregate all exchanges into one line (information loss).
This script does none of those.
Instead, it implements an anchored cumulative delta framework applied individually to each exchange, using a common reset reference. This preserves path dependency — you see how positioning evolved since a known structural point, not just what happened on the last candle.
Key differentiators:
- Exchange-segmented OI accumulation
- Explicit anchor-based reset logic
- Optional normalization into percent-of-total OI
- No smoothing, no averages, no trend assumptions
This is not a trend indicator. It is a positioning flow map.
Data Construction and Normalization
Multi-Contract Aggregation (per exchange)
Each exchange’s total open interest is constructed by summing all available perpetual contracts:
- USD-margined
- USDT-margined
- USDC-margined
Where necessary, contract units are converted into a common base-coin representation so that all venues are directly comparable. This prevents distortions caused by mixed margin types.
The result is a true total OI per exchange, not a single contract proxy.
Anchored Cumulative Delta Logic
Let:
- OI(t) = total open interest at time t for a given exchange
- ΔOI(t)=OI(t) - OI(t-1)
For each bar:
- The script accumulates ΔOI forward in time
- This accumulation resets to zero whenever the anchor period changes
The anchor period is user-defined (default: Daily). At each reset:
- All exchange accumulators are cleared
- The current combined OI across all enabled exchanges is stored as the normalization baseline
This makes every plotted value interpretable as:
“Net positioning added or removed since the last anchor reset.”
Display Modes
1. Actual Change (default)
Plots the absolute net change in open interest since the anchor reset.
Interpretation:
- Large positive values → sustained position building
- Large negative values → sustained position unwinding
- Divergence between exchanges → uneven participation or venue-specific positioning
This mode preserves raw scale and is best for structural analysis.
2. Percent Change (normalized mode)
Each exchange’s cumulative delta is divided by the total combined OI at the anchor reset, then expressed as a percentage.
Percent Change = (Exchange Cumulative OI Delta / Total OI at Anchor) * 100
Interpretation:
- Removes absolute size bias between large and small exchanges
- Allows direct comparison of relative contribution
- Makes regime shifts easier to spot across different assets
This mode answers:
“Which exchange is driving the majority of positioning change relative to the market’s size?”
Visual and Structural Aids
- Zero baseline represents the anchor reset point
- Vertical dashed lines mark anchor transitions
- End-of-chart labels identify each exchange without relying on a legend
- All plots are unsmoothed and unfiltered by design
Noise is not removed — it is contextualized.
How Traders Use This
This indicator is most effective for:
- Detecting exchange-specific accumulation or distribution
- Identifying hidden divergence beneath price
- Confirming whether price moves are supported by broad positioning or isolated leverage
- Comparing how different venues react to the same market event
Typical interpretations:
- Price rising while OI spaghetti diverges → short covering or uneven leverage
- One exchange leading OI expansion → localized risk concentration
- Flat price with rising OI across venues → compression and potential expansion setup
What This Is Not
- Not a trend detector
- Not a momentum oscillator
- Not a signal generator
It provides structural context, not trade entries.
Summary
Open Interest Spaghetti – Multi Exchange is a flow-first, structure-aware OI framework that exposes how derivatives positioning evolves across venues from a shared reference point. By preserving exchange independence, anchoring accumulation, and offering optional normalization, it reveals information that aggregate or smoothed OI indicators inherently destroy.
If you trade derivatives and care where risk is building — not just that it is — this tool is designed for that exact purpose.
Instead of smoothing, normalizing, or trend-filtering open interest, this script intentionally preserves exchange-level granularity and plots each venue’s cumulative OI delta from a shared anchor point. The result is a “spaghetti” structure: multiple independent OI paths evolving in parallel, revealing divergence, dominance, and regime shifts in real time.
Core Idea and Originality
Most OI indicators do one of three things:
1) Plot raw open interest (slow, hard to interpret),
2) Plot OI change per bar (noisy, context-less),
3) Aggregate all exchanges into one line (information loss).
This script does none of those.
Instead, it implements an anchored cumulative delta framework applied individually to each exchange, using a common reset reference. This preserves path dependency — you see how positioning evolved since a known structural point, not just what happened on the last candle.
Key differentiators:
- Exchange-segmented OI accumulation
- Explicit anchor-based reset logic
- Optional normalization into percent-of-total OI
- No smoothing, no averages, no trend assumptions
This is not a trend indicator. It is a positioning flow map.
Data Construction and Normalization
Multi-Contract Aggregation (per exchange)
Each exchange’s total open interest is constructed by summing all available perpetual contracts:
- USD-margined
- USDT-margined
- USDC-margined
Where necessary, contract units are converted into a common base-coin representation so that all venues are directly comparable. This prevents distortions caused by mixed margin types.
The result is a true total OI per exchange, not a single contract proxy.
Anchored Cumulative Delta Logic
Let:
- OI(t) = total open interest at time t for a given exchange
- ΔOI(t)=OI(t) - OI(t-1)
For each bar:
- The script accumulates ΔOI forward in time
- This accumulation resets to zero whenever the anchor period changes
The anchor period is user-defined (default: Daily). At each reset:
- All exchange accumulators are cleared
- The current combined OI across all enabled exchanges is stored as the normalization baseline
This makes every plotted value interpretable as:
“Net positioning added or removed since the last anchor reset.”
Display Modes
1. Actual Change (default)
Plots the absolute net change in open interest since the anchor reset.
Interpretation:
- Large positive values → sustained position building
- Large negative values → sustained position unwinding
- Divergence between exchanges → uneven participation or venue-specific positioning
This mode preserves raw scale and is best for structural analysis.
2. Percent Change (normalized mode)
Each exchange’s cumulative delta is divided by the total combined OI at the anchor reset, then expressed as a percentage.
Percent Change = (Exchange Cumulative OI Delta / Total OI at Anchor) * 100
Interpretation:
- Removes absolute size bias between large and small exchanges
- Allows direct comparison of relative contribution
- Makes regime shifts easier to spot across different assets
This mode answers:
“Which exchange is driving the majority of positioning change relative to the market’s size?”
Visual and Structural Aids
- Zero baseline represents the anchor reset point
- Vertical dashed lines mark anchor transitions
- End-of-chart labels identify each exchange without relying on a legend
- All plots are unsmoothed and unfiltered by design
Noise is not removed — it is contextualized.
How Traders Use This
This indicator is most effective for:
- Detecting exchange-specific accumulation or distribution
- Identifying hidden divergence beneath price
- Confirming whether price moves are supported by broad positioning or isolated leverage
- Comparing how different venues react to the same market event
Typical interpretations:
- Price rising while OI spaghetti diverges → short covering or uneven leverage
- One exchange leading OI expansion → localized risk concentration
- Flat price with rising OI across venues → compression and potential expansion setup
What This Is Not
- Not a trend detector
- Not a momentum oscillator
- Not a signal generator
It provides structural context, not trade entries.
Summary
Open Interest Spaghetti – Multi Exchange is a flow-first, structure-aware OI framework that exposes how derivatives positioning evolves across venues from a shared reference point. By preserving exchange independence, anchoring accumulation, and offering optional normalization, it reveals information that aggregate or smoothed OI indicators inherently destroy.
If you trade derivatives and care where risk is building — not just that it is — this tool is designed for that exact purpose.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.