PROTECTED SOURCE SCRIPT
Cập nhật Key Levels LAB

Description This is a professional Price Action & Liquidity tool designed to map critical institutional reference points across multiple timeframes (Daily, Weekly, Monthly, Yearly, and Quarterly).
Unlike standard Support & Resistance indicators that just plot lines, this script features a proprietary "Ghost Protocol" (Liquidity Mitigation Engine).
Underlying Concepts & Methodology The script uses a custom State Management System to track the lifecycle of each key level:
Level Identification: It detects the Highs and Lows of previous sessions (PDH/PDL, PWH/PWL, etc.) and stores them in persistent variables.
Mitigation Logic (The "Ghost" Effect): The script continuously monitors price action against these stored levels. When price crosses/touches a level (Liquidity Sweep), the script changes the level's visual state (color/transparency) to indicate it has been "Mitigated" or "Liquidated". This helps traders distinguish between fresh liquidity zones and used ones.
Rolling Quarterly Tracking: It includes a unique algorithm to track the highs and lows of the last 4 rolling quarters, essential for macro analysis.
Anti-Overlap Engine: A dynamic labeling system shifts text labels on the X-axis to prevent visual clutter when multiple levels cluster together.
Key Features
Multi-Timeframe Levels: Automatically plots Previous Day/Week/Month/Year Highs and Lows.
Equilibrium Points: Optional 50% (Mid) levels for Weekly and Monthly ranges.
Smart Visualization: Levels fade out or change style after being tested.
Quarterly History: Tracks the institutional quarterly cycle (Q1 to Q4).
How to Use
Fresh Levels (Solid/Bright): Act as magnets for price. Expect a reaction or a sweep.
Mitigated Levels (Ghost/Faded): Indicates liquidity has already been taken. Less likely to provide a strong reaction.
[English Translation of User Interface]
To comply with House Rules regarding non-English UI, here is the translation of the script's settings menu:
1. Configurações Gerais (General Settings)
Rótulos = Show Labels
Preços = Show Prices
Tamanho = Text Size
2. Posicionamento (Positioning)
Base = Base Distance (Bars)
Escalonar = Stagger Labels (Anti-Overlap)
Passo = Step Size
3. Ghost Protocol (Mitigation)
Ativar Efeito Fantasma = Enable Ghost Effect (Mitigation)
Transparência % = Transparency %
4. Níveis (Levels Configuration)
Diário = Daily (PDH/PDL)
Semanal = Weekly (PWH/PWL)
Mensal = Monthly (PMH/PML)
Anual = Yearly (PYH/PYL)
Histórico Trimestral = Quarterly History
Mid (50%) = Midpoint (50% Equilibrium)
Estilo = Style
Espessura = Width
Unlike standard Support & Resistance indicators that just plot lines, this script features a proprietary "Ghost Protocol" (Liquidity Mitigation Engine).
Underlying Concepts & Methodology The script uses a custom State Management System to track the lifecycle of each key level:
Level Identification: It detects the Highs and Lows of previous sessions (PDH/PDL, PWH/PWL, etc.) and stores them in persistent variables.
Mitigation Logic (The "Ghost" Effect): The script continuously monitors price action against these stored levels. When price crosses/touches a level (Liquidity Sweep), the script changes the level's visual state (color/transparency) to indicate it has been "Mitigated" or "Liquidated". This helps traders distinguish between fresh liquidity zones and used ones.
Rolling Quarterly Tracking: It includes a unique algorithm to track the highs and lows of the last 4 rolling quarters, essential for macro analysis.
Anti-Overlap Engine: A dynamic labeling system shifts text labels on the X-axis to prevent visual clutter when multiple levels cluster together.
Key Features
Multi-Timeframe Levels: Automatically plots Previous Day/Week/Month/Year Highs and Lows.
Equilibrium Points: Optional 50% (Mid) levels for Weekly and Monthly ranges.
Smart Visualization: Levels fade out or change style after being tested.
Quarterly History: Tracks the institutional quarterly cycle (Q1 to Q4).
How to Use
Fresh Levels (Solid/Bright): Act as magnets for price. Expect a reaction or a sweep.
Mitigated Levels (Ghost/Faded): Indicates liquidity has already been taken. Less likely to provide a strong reaction.
[English Translation of User Interface]
To comply with House Rules regarding non-English UI, here is the translation of the script's settings menu:
1. Configurações Gerais (General Settings)
Rótulos = Show Labels
Preços = Show Prices
Tamanho = Text Size
2. Posicionamento (Positioning)
Base = Base Distance (Bars)
Escalonar = Stagger Labels (Anti-Overlap)
Passo = Step Size
3. Ghost Protocol (Mitigation)
Ativar Efeito Fantasma = Enable Ghost Effect (Mitigation)
Transparência % = Transparency %
4. Níveis (Levels Configuration)
Diário = Daily (PDH/PDL)
Semanal = Weekly (PWH/PWL)
Mensal = Monthly (PMH/PML)
Anual = Yearly (PYH/PYL)
Histórico Trimestral = Quarterly History
Mid (50%) = Midpoint (50% Equilibrium)
Estilo = Style
Espessura = Width
Phát hành các Ghi chú
Description This is a major update to the Key Levels LAB, a professional Price Action & Liquidity mapping tool. It automatically identifies critical institutional reference points (PDH/L, PWH/L, Quarterly Levels) and manages their visual state using a proprietary "Ghost Protocol".What's New in This Version?
Terminus Extension Engine: Instead of just fixed bars, lines can now extend to specific time targets (e.g., Next Midnight, NY Close, +4 Hours). This keeps charts cleaner.
Vertical Staggering (Anti-Overlap): A smart algorithm that vertically shifts text labels when price levels are clustered too close together, ensuring readability.
True Opens: Added specific session opening levels: NY Midnight (00:00), NY Open (08:30), and Stocks Open (09:30).
Enhanced Dashboard: New dark/light themes and simplified status icons for active vs. mitigated levels.
Underlying Concepts & Methodology
Liquidity State Management: The script tracks the "life" of a level. When price touches a High or Low, the "Ghost Protocol" triggers, changing the level's style to indicate it has been mitigated (liquidity swept).
Quarterly Cycle: It tracks the rolling 4-quarter history (Q1 to Q4), essential for macro institutional analysis.
Visual Geometry: The logic prioritizes chart cleanliness by cutting off lines after mitigation (optional) or fading them out.
How to Use
Fresh Levels (Solid/Colored): These are active magnets for price.
Ghost Levels (Gray/Dotted): These levels have been tested. Proceed with caution as their structural integrity is weakened.
Terminus: Set the extension to "Next Midnight" to see how levels relate to the current daily session boundaries.
[English Translation of User Interface]
To comply with House Rules regarding non-English UI, here is the translation of the updated settings menu:
1. Visual dos Rótulos (Visuals)
Mostrar Nomes = Show Names
Mostrar Preços = Show Prices
Fonte = Font Size
2. Posicionamento & Extensão (Geometry)
Tipo de Extensão = Extension Type (Fixed Bars vs. Time Target)
Alvo Temporal (Terminus) = Time Target (Next Midnight, +1h, NY Close, etc.)
Distância = Distance (Bars)
3. Escalonamento Vertical (Vertical Staggering)
Ativar Escada = Enable Staggering (Anti-Overlap)
Distância entre Degraus = Step Distance
4. Dashboard
Exibir Tabela = Show Table
Posição = Position
Tema Visual = Visual Theme (Dark/Light)
5. Ghost Protocol (Mitigation)
Ativar Mitigação = Enable Mitigation
Mitigar Históricos (Qs)? = Mitigate Quarterly Levels?
Estilo = Style (Ghost vs. Cut Line)
Cor Ghost = Ghost Color
6. Níveis (Levels)
Diário/Semanal/Mensal/Anual = Daily/Weekly/Monthly/Yearly (PDH/L to PYH/L)
Mid (50%) = Midpoint
Histórico Trimestral (Q1-Q4) = Quarterly History
7. True Opens (Session Opens)
Midnight Open = 00:00 NY Open
NY Open = 08:30 NY
Stocks Open = 09:30 NY
Prev Day Close = Previous Day Close
Phát hành các Ghi chú
Description This is a major update to the Key Levels LAB, a professional Price Action & Liquidity mapping tool. It automatically identifies critical institutional reference points (PDH/L, PWH/L, Quarterly Levels) and manages their visual state using a proprietary "Ghost Protocol".What's New in This Version?
Terminus Extension Engine: Instead of just fixed bars, lines can now extend to specific time targets (e.g., Next Midnight, NY Close, +4 Hours). This keeps charts cleaner for intraday trading.
Vertical Staggering (Anti-Overlap): A smart algorithm that vertically shifts text labels when price levels are clustered too close together, ensuring readability.
True Opens: Added specific session opening levels: Midnight Open (00:00), NY Open (08:30), and Stocks Open (09:30).
Enhanced Dashboard: New Dark/Light themes and simplified status icons.
Underlying Concepts & Methodology
Liquidity State Management: The script tracks the "life" of a level. When price touches a High or Low, the "Ghost Protocol" triggers, changing the level's style to indicate it has been mitigated (liquidity swept).
Quarterly Cycle: It tracks the rolling 4-quarter history (Q1 to Q4), essential for macro institutional analysis.
Sniper Logic: Automatically merges levels from different timeframes that are within a few ticks of each other (e.g., PDH = Weekly Open) into a single "Confluence Line" to reduce clutter.
How to Use
Fresh Levels (Solid/Colored): These are active magnets for price.
Ghost Levels (Gray/Dotted): These levels have been tested. Proceed with caution as their structural integrity is weakened.
Terminus: Set the extension to "Next Midnight" to see how levels relate to the current daily session boundaries.
[English Translation of User Interface]
To comply with House Rules regarding non-English UI, here is the translation of the updated settings menu:
1. Ajustes Gerais & Geometria (General Settings)
Tamanho da Fonte = Font Size
Nomes/Preços = Show Names / Show Prices
Extensão de Linha = Line Extension (Fixed Bars vs. Time Target)
Alvo Temporal (Terminus) = Time Target (Next Midnight, +1h, NY Close, etc.)
Escalonamento Vertical = Vertical Staggering (Anti-Overlap)
Degrau = Step Size
2. Lógica Institucional (Logic)
Ativar Mitigação (Ghost) = Enable Mitigation
Mitigar Históricos (Qs)? = Mitigate Quarterly Levels?
Cor Ghost = Ghost Color (Mitigated)
Ativar Confluência (Sniper) = Enable Confluence Merge
Tolerância = Tolerance (Ticks)
Ativar Alertas = Enable Alerts
3. Key Levels (Standard)
Master Switch = Toggle All
Daily/Weekly/Monthly/Yearly = PDH/L, PWH/L, PMH/L, PYH/L
Mid 50% = Midpoint (Equilibrium)
4. Histórico Trimestral (Quarterly)
Q-1 (Último) = Last Quarter (Q1)
Q-2/Q-3/Q-4 = Previous Quarters
5. True Opens (Session Opens)
Midnight Open = 00:00 Exchange Time
NY Open = 08:30 NY Time
Stocks Open = 09:30 NY Time
Weekly/Monthly/Quarterly/Yearly Open = WO, MO, QO, YO
True Year (Q2) = Institutional Year Open
6. Dashboard
Exibir Tabela = Show Table
Posição/Tamanho = Position/Size
Tema Visual = Visual Theme (Dark/Light)
Phát hành các Ghi chú
Major Update: Temporal Fusion Engine & HTF OptimizationTexto da Descrição (Copie a partir daqui):
This is a structural evolution of the Key Levels LAB. We have integrated a Time & Cycle Engine directly into the Price Action logic. This update transforms the indicator from a purely horizontal price mapper into a complete Price & Time institutional workstation.
What is New in This Version?
Temporal Dividers Engine (New Module):
Vertical Separation: The script now mathematically calculates and plots vertical separators for Yearly (Solid Line) and Quarterly (Dashed Line) shifts. This allows for instant recognition of the Macro Cycle (Q1-Q4) directly on the chart.
Hybrid Labeling System: We implemented a smart labeling logic for the current quarter. The label (e.g., "Q1 | 26") floats dynamically with the current price action until the mid-quarter reference date is reached, at which point it locks into a fixed position at the bottom.
Smart History Filter (Performance):
To prevent chart clutter and optimize loading times, we added a Limit History input. Instead of calculating infinite lines, you can now define exactly how many years of historical data you want to visualize (e.g., "3 Years"). The algorithm automatically calculates the cutoff date based on the current timestamp.
HTF True Opens Optimization:
Satellite Data Fetching: Previous versions of "True Opens" (Midnight, NY Open, Stocks Open) could disappear on higher timeframes (H4, D1, W1) because the specific minute candles were "swallowed".
The Fix: We implemented a request.security logic that fetches the precise opening prices from lower timeframes and projects them onto any higher timeframe. Now, your NY Open level is visible even on a Weekly chart.
Methodology Recap (Core Features)
Ghost Protocol: The script monitors price interaction with key levels. Once a level is touched (liquidity swept), its visual state changes (Ghost mode) to indicate mitigation.
Sniper Logic: Automatically merges levels from different timeframes if they are within a defined tick tolerance, creating a single "Confluence Line".
Escalation Algorithm: Prevents text overlap by vertically stacking labels when price action is compressed.
[English Translation of User Interface]
To comply with House Rules regarding non-English UI, here is the translation of the new settings introduced in this version:
1.0 » DIVISORES DE TEMPO (Time Dividers)
Limitar Histórico (Anos) = History Limit (Years)
Separador ANO = Year Separator (Show/Hide)
Separador TRIMESTRE = Quarter Separator (Show/Hide)
Legendas Rodapé = Bottom Labels (Show Qx | Year)
Esp. (Espessura) = Line Width
5.0 » TRUE OPENS (Optimized)
Note: These levels now work seamlessly on Higher Timeframes (H4, Daily, etc).
(All other settings from previous versions regarding Daily/Weekly/Monthly levels and Ghost Protocol remain unchanged).
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể sử dụng tự do và không giới hạn – tìm hiểu thêm tại đây.
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ã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể sử dụng tự do và không giới hạn – tìm hiểu thêm tại đây.
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.