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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.