OPEN-SOURCE SCRIPT
HTF Structure Lens

HTF Structure Lens
HTF Structure Lens is a multi-timeframe market-structure workspace designed to bring higher-timeframe price action and structural events directly onto the active chart.
Rather than switching repeatedly between timeframes, the indicator displays up to six higher-timeframe candle sets alongside the structural information derived from those candles. Its purpose is to provide a single visual framework for following higher-timeframe liquidity, candle structure and changes in delivery while executing on a lower timeframe.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WHY THESE FEATURES ARE COMBINED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The features in HTF Structure Lens are designed around the same higher-timeframe price structure rather than functioning as unrelated indicators.
The HTF candles provide the underlying price representation. Swing levels and liquidity sweeps identify where those candles interact with previous extremes. C2/C3 classification identifies specific sweep, closure and reversal behaviour within that structure. CISD provides a separate delivery-confirmation layer that can then be compared with those higher-timeframe events.
This allows a trader, for example, to observe a higher-timeframe liquidity sweep and C2 closure while simultaneously monitoring lower-timeframe CISD confirmation without changing charts.
The indicator is intended as a discretionary analysis tool. It does not automatically determine directional bias, entries, exits or trade recommendations.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
MULTI-TIMEFRAME HTF CANDLES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Display up to six independent higher-timeframe candle sets simultaneously.
Each set includes configurable:
• Timeframe
• Number of displayed candles
• Candle spacing and positioning
• Body, border and wick styling
The currently forming HTF candle updates as new price data becomes available. Completed HTF candles retain their completed OHLC structure.
Per-chart-timeframe visibility controls allow different HTF sets to be displayed depending on the timeframe currently being viewed.
An optional Automatic HTF Ladder can dynamically adjust selected HTFs as the chart timeframe changes.
Daily candles can also use selectable session-based boundaries, including Midnight, 08:30 and 09:30 New York time.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
STRUCTURE AND SWINGS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTF Structure Lens identifies structural information directly from the displayed higher-timeframe candles.
Swing highs and lows can be displayed with separate styling for potential and confirmed levels.
An optional equilibrium (EQ) line marks the midpoint of a candle's range.
Fair Value Gaps and Volume Imbalances can also be displayed within the HTF candle representation to provide additional context around price delivery.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
C2 CLOSURE AND C3 REVERSAL
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The indicator includes a three-candle fractal framework for classifying specific higher-timeframe candle behaviour.
C2 Closure
A bullish C2 occurs when price trades below the previous candle's low and subsequently closes back above that level. A bearish C2 occurs when price trades above the previous candle's high and subsequently closes back below that level. Outside candles that sweep both sides are excluded from C2 classification.
C3 Reversal
C3 logic identifies a separate body-engulfing reversal condition where the previous candle's body is engulfed without the corresponding liquidity sweep required for a C2. Continuation cases following an existing C2 are filtered so that standalone C3 reversals can be distinguished from continuation behaviour.
C2 and C3 labels can be displayed on the HTF candle representation and, optionally, on the underlying chart bar where the completed HTF event occurred.
Confirmed C2/C3 classifications use completed candle information.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
LIQUIDITY SWEEP VISUALIZATION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTF liquidity levels can be projected back onto the underlying chart so that the origin and eventual sweep of a higher-timeframe level can be seen directly within lower-timeframe price action.
Two modes are available:
Confirmed Sweeps — displays sweeps that subsequently close back through the relevant level, corresponding with C2 closure behaviour.
All Sweeps — displays any wick that trades through the relevant previous level regardless of the eventual candle close.
Sweep-line appearance is configurable.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CISD — CHANGE IN STATE OF DELIVERY
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTF Structure Lens includes an independent CISD framework that can monitor up to three timeframes simultaneously.
Each CISD instance can use the current chart timeframe or a separately selected timeframe.
The display can include:
• Developing CISD level
• Confirmed CISD level
• Protected swing associated with the current delivery state
This allows lower-timeframe delivery changes to be viewed in the context of higher-timeframe structural events displayed by the rest of the indicator.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTF PERIOD BOUNDARY
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
An optional HTF Period Boundary marks the beginning of a selected higher-timeframe period directly on the underlying chart.
This can be used to visually align lower-timeframe price action with the opening of Daily, 4H or other selected HTF periods.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ALERTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Independent alerts are available for:
• Bullish and bearish C2 Closures
• Bullish and bearish C3 Reversals
• CISD confirmations
C2/C3 alerts can be selected independently for the displayed higher timeframes.
Confirmed structural alerts are designed to trigger from completed candle information rather than developing HTF conditions.
Alert messages include relevant ticker, timeframe and directional information.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
REPAINTING / LIVE DATA BEHAVIOUR
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The currently forming HTF candles and developing structural levels update as new price information becomes available. This is intentional because they represent live, incomplete market structure.
Confirmed C2/C3 events and other completed-candle structural classifications use completed candle data and are not subsequently recalculated from changes to the live candle.
Users should therefore distinguish between developing visual information and confirmed structural events.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ORIGINALITY AND OPEN-SOURCE ATTRIBUTION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTF Structure Lens builds upon the open-source ICT HTF Candles (fadi) script by fadizeidan, which provided part of the original higher-timeframe candle visualization foundation. The original work is licensed under the Mozilla Public License 2.0.
This project substantially extends that foundation into a broader multi-timeframe structure-analysis environment. Additions and modifications include functionality such as C2/C3 structural classification, liquidity sweep tracking and chart projection, swing-state visualization, equilibrium levels, multi-timeframe CISD analysis, structural alerts, timeframe-dependent visibility, Automatic HTF Ladder behaviour, HTF period boundaries, and additional integration between higher-timeframe structure and the underlying chart.
The source code is published openly in accordance with TradingView's open-source reuse requirements and to preserve attribution to the original work.
Credit to fadizeidan for the open-source HTF candle foundation that contributed to the development of this project.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
USAGE AND LIMITATIONS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTF Structure Lens is designed for discretionary multi-timeframe analysis. Structural classifications such as C2, C3, sweeps and CISD represent defined price-action conditions; they should not be interpreted as automatic buy or sell signals.
Live HTF candles and developing levels can change until their respective periods close.
Users should test the indicator on the markets, sessions and timeframes relevant to their own analysis.
This indicator is provided for educational and informational purposes only and does not constitute financial advice. Historical price behaviour does not guarantee future results.
HTF Structure Lens is a multi-timeframe market-structure workspace designed to bring higher-timeframe price action and structural events directly onto the active chart.
Rather than switching repeatedly between timeframes, the indicator displays up to six higher-timeframe candle sets alongside the structural information derived from those candles. Its purpose is to provide a single visual framework for following higher-timeframe liquidity, candle structure and changes in delivery while executing on a lower timeframe.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WHY THESE FEATURES ARE COMBINED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The features in HTF Structure Lens are designed around the same higher-timeframe price structure rather than functioning as unrelated indicators.
The HTF candles provide the underlying price representation. Swing levels and liquidity sweeps identify where those candles interact with previous extremes. C2/C3 classification identifies specific sweep, closure and reversal behaviour within that structure. CISD provides a separate delivery-confirmation layer that can then be compared with those higher-timeframe events.
This allows a trader, for example, to observe a higher-timeframe liquidity sweep and C2 closure while simultaneously monitoring lower-timeframe CISD confirmation without changing charts.
The indicator is intended as a discretionary analysis tool. It does not automatically determine directional bias, entries, exits or trade recommendations.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
MULTI-TIMEFRAME HTF CANDLES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Display up to six independent higher-timeframe candle sets simultaneously.
Each set includes configurable:
• Timeframe
• Number of displayed candles
• Candle spacing and positioning
• Body, border and wick styling
The currently forming HTF candle updates as new price data becomes available. Completed HTF candles retain their completed OHLC structure.
Per-chart-timeframe visibility controls allow different HTF sets to be displayed depending on the timeframe currently being viewed.
An optional Automatic HTF Ladder can dynamically adjust selected HTFs as the chart timeframe changes.
Daily candles can also use selectable session-based boundaries, including Midnight, 08:30 and 09:30 New York time.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
STRUCTURE AND SWINGS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTF Structure Lens identifies structural information directly from the displayed higher-timeframe candles.
Swing highs and lows can be displayed with separate styling for potential and confirmed levels.
An optional equilibrium (EQ) line marks the midpoint of a candle's range.
Fair Value Gaps and Volume Imbalances can also be displayed within the HTF candle representation to provide additional context around price delivery.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
C2 CLOSURE AND C3 REVERSAL
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The indicator includes a three-candle fractal framework for classifying specific higher-timeframe candle behaviour.
C2 Closure
A bullish C2 occurs when price trades below the previous candle's low and subsequently closes back above that level. A bearish C2 occurs when price trades above the previous candle's high and subsequently closes back below that level. Outside candles that sweep both sides are excluded from C2 classification.
C3 Reversal
C3 logic identifies a separate body-engulfing reversal condition where the previous candle's body is engulfed without the corresponding liquidity sweep required for a C2. Continuation cases following an existing C2 are filtered so that standalone C3 reversals can be distinguished from continuation behaviour.
C2 and C3 labels can be displayed on the HTF candle representation and, optionally, on the underlying chart bar where the completed HTF event occurred.
Confirmed C2/C3 classifications use completed candle information.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
LIQUIDITY SWEEP VISUALIZATION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTF liquidity levels can be projected back onto the underlying chart so that the origin and eventual sweep of a higher-timeframe level can be seen directly within lower-timeframe price action.
Two modes are available:
Confirmed Sweeps — displays sweeps that subsequently close back through the relevant level, corresponding with C2 closure behaviour.
All Sweeps — displays any wick that trades through the relevant previous level regardless of the eventual candle close.
Sweep-line appearance is configurable.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CISD — CHANGE IN STATE OF DELIVERY
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTF Structure Lens includes an independent CISD framework that can monitor up to three timeframes simultaneously.
Each CISD instance can use the current chart timeframe or a separately selected timeframe.
The display can include:
• Developing CISD level
• Confirmed CISD level
• Protected swing associated with the current delivery state
This allows lower-timeframe delivery changes to be viewed in the context of higher-timeframe structural events displayed by the rest of the indicator.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTF PERIOD BOUNDARY
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
An optional HTF Period Boundary marks the beginning of a selected higher-timeframe period directly on the underlying chart.
This can be used to visually align lower-timeframe price action with the opening of Daily, 4H or other selected HTF periods.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ALERTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Independent alerts are available for:
• Bullish and bearish C2 Closures
• Bullish and bearish C3 Reversals
• CISD confirmations
C2/C3 alerts can be selected independently for the displayed higher timeframes.
Confirmed structural alerts are designed to trigger from completed candle information rather than developing HTF conditions.
Alert messages include relevant ticker, timeframe and directional information.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
REPAINTING / LIVE DATA BEHAVIOUR
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The currently forming HTF candles and developing structural levels update as new price information becomes available. This is intentional because they represent live, incomplete market structure.
Confirmed C2/C3 events and other completed-candle structural classifications use completed candle data and are not subsequently recalculated from changes to the live candle.
Users should therefore distinguish between developing visual information and confirmed structural events.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ORIGINALITY AND OPEN-SOURCE ATTRIBUTION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTF Structure Lens builds upon the open-source ICT HTF Candles (fadi) script by fadizeidan, which provided part of the original higher-timeframe candle visualization foundation. The original work is licensed under the Mozilla Public License 2.0.
This project substantially extends that foundation into a broader multi-timeframe structure-analysis environment. Additions and modifications include functionality such as C2/C3 structural classification, liquidity sweep tracking and chart projection, swing-state visualization, equilibrium levels, multi-timeframe CISD analysis, structural alerts, timeframe-dependent visibility, Automatic HTF Ladder behaviour, HTF period boundaries, and additional integration between higher-timeframe structure and the underlying chart.
The source code is published openly in accordance with TradingView's open-source reuse requirements and to preserve attribution to the original work.
Credit to fadizeidan for the open-source HTF candle foundation that contributed to the development of this project.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
USAGE AND LIMITATIONS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTF Structure Lens is designed for discretionary multi-timeframe analysis. Structural classifications such as C2, C3, sweeps and CISD represent defined price-action conditions; they should not be interpreted as automatic buy or sell signals.
Live HTF candles and developing levels can change until their respective periods close.
Users should test the indicator on the markets, sessions and timeframes relevant to their own analysis.
This indicator is provided for educational and informational purposes only and does not constitute financial advice. Historical price behaviour does not guarantee future results.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.