OPEN-SOURCE SCRIPT
Cập nhật BTC CME Futures Gaps (BTCGapHunt_CME)

BTC CME Futures Gaps Indicator
Overview
This indicator visualises price gaps between the daily close and open of Bitcoin CME futures (CME:BTC1!). These gaps are often revisited ("filled") by market price action and may serve as technical targets.
Thanks
... to Maven and the Blockchain Masons (x.com/Masons_DAO) to push me on this topic.
What Is a CME Gap?
Key Features
Supported and Overrideable Parameters
How the Gap Size Is Calculated
Visual Guide
Alerts
Recommended Timeframes
How To Use
Notes
Disclaimer
This script is for educational purposes only. Trade at your own risk.
Overview
This indicator visualises price gaps between the daily close and open of Bitcoin CME futures (CME:BTC1!). These gaps are often revisited ("filled") by market price action and may serve as technical targets.
Thanks
... to Maven and the Blockchain Masons (x.com/Masons_DAO) to push me on this topic.
What Is a CME Gap?
- CME Bitcoin Futures do not trade 24/7. Gaps form when the market reopens at a different price than where it last closed.
- Gaps are often used as support/resistance or liquidity targets.
- This indicator tracks, visualises, and alerts on these gaps.
Key Features
- Automatic gap detection using daily open/close on CME:BTC1!
- Dynamic gap size threshold based on ATR (Average True Range)
- Highlight unfilled gaps and track partial fills visually
- Alerts for gap formation and fill events
- Parameter overlay showing real-time settings
Supported and Overrideable Parameters
- ATR Length: Defines the lookback period for ATR calculation (default: 14)
- Gap Size Multiplier: Multiplies the ATR to set the dynamic gap threshold (default: 1.0)
- Proximity Threshold: Price distance from gap edge to consider it filled (default: 100 USD)
- Max Gaps Tracked: Maximum number of concurrent gaps shown (default: 50)
- Alerts Enabled: Toggle alerts for gap formation and gap fill events
How the Gap Size Is Calculated
Minimum Gap Size = ATR(14) * Gap Size Multiplier
- ATR Length and Gap Size Multiplier are configurable.
- Gap threshold adjusts dynamically with market volatility.
Visual Guide
- Red Box: Fully unfilled gap
- Lemon Yellow Box: Partially filled gap
- Right Margin Boxes: Snapshot of unfilled gaps for quick access
- Top-Right Panel: Current ATR, Gap Size, Thresholds, etc.
Alerts
- Gap Formed: A new gap is detected.
- Gap Filled: The gap is either partially or fully filled.
Recommended Timeframes
- 1H, 4H, 1D (best resolution)
- Designed for BTC spot/perpetual charts (e.g., BTCUSD, BTCUSDT)
How To Use
- Add the script to your BTC chart.
- Monitor red/yellow boxes for unfilled gaps.
- Check config panel for current threshold and settings.
- Enable alerts via TradingView for real-time updates.
Notes
- Up to 50 gaps are tracked (adjustable).
- Data source: CME futures via request.security.
- All visuals and alerts are time-synced with your chart.
Disclaimer
This script is for educational purposes only. Trade at your own risk.
Phát hành các Ghi chú
Changelog: BTC CME Futures Gaps Indicator (Enhanced)Version Enhancements
- Static Gap Size Option
Users can override ATR-based dynamic gap sizing with a static USD threshold.
New Parameters: Use Static Gap Size (default: false)
Static Gap Size (default: 100 USD) - Improved Visual Filtering
Gaps smaller than 0.01 USD are not shown, both in the chart and right margin. This reduces noise from insignificant gaps. - Robustness Enhancements Safe array access with boundary checks to avoid runtime errors.
Improved cleanup when gaps are removed due to fill or threshold conditions.
Increased stability when processing high bar counts. - Dynamic UI Table Update
Now displays both dynamic (ATR-based) and static gap size values for clarity. - Performance Optimisation
Efficient array handling and early exit conditions improve runtime reliability and reduce overhead.
Impact Summary
- Greater user control over gap sensitivity.
- Cleaner chart visuals with fewer micro-gaps.
- More stable script behaviour under all conditions.
- Better transparency with enhanced parameter display.
Phát hành các Ghi chú
Fixed issues on 4h and 1d, enabled by default manual gap size and use 250USD as relevant gap.Phát hành các Ghi chú
Bugfix all time dimensionsPhát hành các Ghi chú
fix: Consistent appearance on 1h, 4h, 1dPhát hành các Ghi chú
Added far right located boxes to visualiye unfilled gaps in one placeMã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.