OPEN-SOURCE SCRIPT
Cập nhật Key Levels - Cash Market

This is a Pine v6 modernization of the original SpacemanBTC Key Levels indicator. The original was already a useful way to keep important higher-timeframe levels on chart, but parts of the session logic, timezone handling, and display system were showing their age—especially for equities and index futures traders.
This version keeps the same core idea while rebuilding the underlying logic for cleaner, more reliable behavior.
What changed
Based on the original Key Levels SpacemanBTC IDWM source. The original source credited sbtnc for the base code. This version remains open source with credit to the work it was built from.
This version keeps the same core idea while rebuilding the underlying logic for cleaner, more reliable behavior.
What changed
- Updated to Pine Script v6
Modernized the codebase and removed a large amount of repetitive legacy plotting logic. - Cash-market sessions instead of FX-style sessions
London, New York, and Tokyo now use their actual local cash-market hours rather than generic FX session windows. - Timezone-aware session handling
Sessions use Europe/London, America/New_York, and Asia/Tokyo, so daylight-saving changes are handled automatically. - More reliable session High / Low / Open levels
Session tracking was rebuilt to reset from the actual first bar of each session, avoiding incorrect levels caused by gaps, stale values, or RTH-only charts. - Improved Tokyo handling
The Tokyo range accounts for the exchange's midday lunch break while preserving the morning range into the afternoon session. - Non-repainting Current Year levels
Current Year High, Low, and Mid were rewritten to avoid higher-timeframe lookahead behavior that could make historical levels differ from what was available in real time. - Improved Monday Range for futures
Uses TradingView's trading-day logic so overnight futures sessions—such as NQ beginning Sunday evening—are correctly associated with Monday. - Simplified display controls
The old Distance and Anchor Distance controls were replaced by a single Right Offset setting. Right Anchored mode now simply starts levels at the current bar. - Cleaner session settings UI
Each cash session now has its enable toggle, session time, and color on the same row. - Global Coloring is now truly global
London, New York, and Tokyo session levels now respect the Global Coloring setting as well.
Based on the original Key Levels SpacemanBTC IDWM source. The original source credited sbtnc for the base code. This version remains open source with credit to the work it was built from.
Phát hành các Ghi chú
Automatic label staggeringNearby levels that are not at the exact same price are shifted horizontally to prevent overlapping text, while each line remains at its true price. Exact-price levels are still merged normally.
Phát hành các Ghi chú
Automatic label staggeringNearby levels that are not at the exact same price are shifted horizontally to prevent overlapping text, while each line remains at its true price. Exact-price levels are still merged normally.
Phát hành các Ghi chú
I discovered an issue where the global color picker would freeze on one color. This was due to an aesthetic feature that would grey-out the global color picker in settings if it wasn't enabled, via the code: TradingView can occasionally behave oddly with conditionally active inputs so I just removed that line and it works great now. No core logic was affected, this was strictly a cosmetic user interface issue.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.