OPEN-SOURCE SCRIPT
已更新 Spot Premium with ROC

Description:
This indicator tracks the spot premium of BTC by comparing the perpetual futures price (perp) from Binance against the spot price on Coinbase. The histogram displays the price difference (spot minus perp) with green bars when spot is higher and red when perp carries a premium. The Rate of Change (ROC) line measures how quickly this premium shifts, with an option to normalize fluctuations for greater stability.
Implications & Possible Use Cases:
Let me know if you would like additional features.
This indicator tracks the spot premium of BTC by comparing the perpetual futures price (perp) from Binance against the spot price on Coinbase. The histogram displays the price difference (spot minus perp) with green bars when spot is higher and red when perp carries a premium. The Rate of Change (ROC) line measures how quickly this premium shifts, with an option to normalize fluctuations for greater stability.
Implications & Possible Use Cases:
- • Market Sentiment Gauge: A sustained positive premium often indicates bullish sentiment, while a discount can signal bearish bias.
- • Arbitrage Signals: Significant divergences between perp and spot may present short-term arbitrage opportunities across exchanges.
- • Risk Management & Hedging: Traders can align derivatives and spot positions when premiums deviate sharply, reducing funding cost exposures.
- • Funding Rate Insights: Since perp funding rates tend to follow premium levels, this indicator can act as an early warning for funding spikes.
- • Trend Confirmation: Use the normalized ROC to confirm continuation or reversal of premium trends, filtering out noise around small diff values.
Let me know if you would like additional features.
版本注释
Description:This indicator tracks the spot premium of BTC by comparing the perpetual futures price (perp) from Binance against the spot price on Coinbase. The histogram displays the price difference (spot minus perp) with green bars when spot is higher and red when perp carries a premium. The Rate of Change (ROC) line measures how quickly this premium shifts, with an option to normalize fluctuations for greater stability.
Implications & Possible Use Cases:
- • Market Sentiment Gauge: A sustained positive premium often indicates bullish sentiment, while a discount can signal bearish bias.
- • Arbitrage Signals: Significant divergences between perp and spot may present short-term arbitrage opportunities across exchanges.
- • Risk Management & Hedging: Traders can align derivatives and spot positions when premiums deviate sharply, reducing funding cost exposures.
- • Funding Rate Insights: Since perp funding rates tend to follow premium levels, this indicator can act as an early warning for funding spikes.
- • Trend Confirmation: Use the normalized ROC to confirm continuation or reversal of premium trends, filtering out noise around small diff values.
版本注释
Description:This indicator tracks the spot premium of BTC by comparing the perpetual futures price (perp) from Binance against the spot price on Coinbase. The histogram displays the price difference (spot minus perp) with green bars when spot is higher and red when perp carries a premium. The Rate of Change (ROC) line measures how quickly this premium shifts, with an option to normalize fluctuations for greater stability.
Implications & Possible Use Cases:
- • Market Sentiment Gauge: A sustained positive premium often indicates bullish sentiment, while a discount can signal bearish bias.
- • Arbitrage Signals: Significant divergences between perp and spot may present short-term arbitrage opportunities across exchanges.
- • Risk Management & Hedging: Traders can align derivatives and spot positions when premiums deviate sharply, reducing funding cost exposures.
- • Funding Rate Insights: Since perp funding rates tend to follow premium levels, this indicator can act as an early warning for funding spikes.
- • Trend Confirmation: Use the normalized ROC to confirm continuation or reversal of premium trends, filtering out noise around small diff values.
版本注释
Mode: - “Auto” uses the chart’s symbol with chosen exchange prefixes; “Manual” lets you input full symbol codes.
- Spot Exchange: exchange prefix for spot (e.g., “COINBASE”)
- Derivatives Exchange: ex
版本注释
Added tooltips版本注释
- Volume Intensity: histogram bars adjust opacity based on volume relative to its SMA over a lookback period.
版本注释
Fix to the Auto mode版本注释
added ribbons for the ROC版本注释
Update Summary — Spot/Perp Premium + Basis (Vol-Weighted)Core upgrade
• Added the “tri-calculation” basis:
Tri-Calc = (CB–BIN Spot) − (CB–BIN Perp) = BIN Perp − BIN Spot
→ isolates Binance perp premium vs. Binance spot (local leverage sentiment).
• Keeps your prior two spreads for context:
1) CB Spot − BIN Spot (inter-venue spot flow)
2) CB Spot − BIN Perp (cross-venue spot vs. perp)
Display & defaults
• Toggles: Show CB−BIN Spot (ON), Show CB−BIN Perp (OFF), Show Tri-Calc (ON).
• Tri-Calc style: Line (default) or Histogram, with a “Tri-Calc Visual Scale” multiplier.
• Tri EMA line: always available via “Always Show Tri EMA (Line)”; color-coded by sign:
>0 → #00FFBD (teal), <0 → #E600FF (magenta). Honors optional −1 offset.
Symbol handling
• Auto/Manual symbol mode with robust base-asset detection (suffix-aware strip of .P/USDT/USDC/USD).
• Manual symbol overrides for CB spot, BIN spot, BIN perp.
Volume → histogram opacity
• Choose volume source: Spot / Deriv / Average.
• Mapping: SMA Ratio (squashed) or Percentile (more regime-stable), or Off.
• High volume = opaque bars; low volume = more transparent.
Momentum / impulse context (experimental overlays)
• Z-Score: shades when |Z| > threshold (mean/stdev).
• EMA+ROC: plots Tri EMA; background shades off MAD-normalized ROC of that EMA.
• Robust Z (MAD): outlier-resistant z-score flavor.
• RSI (of Tri): optional line plotted as (RSI−50)×scale for on-pane visibility; shade above/below bands.
• MACD (of Tri): optional MACD/Signal lines + histogram with a visual scale.
ROC ribbon (spread momentum)
• Short/long SMA of absolute changes on the first enabled series (spot-spot, else spot-perp, else tri).
• Filled ribbon flips color on short>long.
Reading the signals (quick cheat-sheet)
• CB Spot − BIN Spot rising while Tri-Calc (basis) depressed → spot-led accumulation, leverage risk-off:
Bias toward relief-up once perps re-engage (basis turns up).
• Basis ramping with CB premium flattening/falling → perp-led chase, prone to fade if spot demand isn’t present.
• RSI/MACD overlays on Tri help time the leverage “baton pass” (crosses/thresholds confirm rotation).
Good defaults to start
• Volume Lookback = 30, Volume Source = Spot, Mapping = Percentile.
• Z-Score: Lookback = 50, Threshold = 2.0.
• EMA+ROC: EMA = 9, ROC = 5, ROC threshold ≈ 1.0–1.5.
• RSI: Length = 14, Bands = 31 / 69, Visual Scale ≈ 0.5–1.0.
• MACD: 8/21/9 with Visual Scale ≈ 1.0–2.0.
Notes / pitfalls
• Pine arg ordering: once you use named args in plot(), name them all — start with series=...
• If overlays seem “invisible,” raise the RSI/MACD visual scale knobs to fit the pane amplitude.
• Tri EMA color is sign-based; Tri-Calc line/hist colors remain as configured.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。