OPEN-SOURCE SCRIPT
SMC Analysis - Fair Value Gaps (Enhanced)

SMC Analysis - Fair Value Gaps (Enhanced) Script Summary
Overview
The "SMC Analysis - Fair Value Gaps (Enhanced)" script, written in Pine Script (version 6), is a technical analysis indicator designed for TradingView to identify and visualize Fair Value Gaps (FVGs) on a price chart. It supports both the main timeframe and multiple higher timeframes (MTF) for comprehensive market analysis. FVGs are price gaps formed by a three-candle pattern, indicating potential areas of market inefficiency where price may return to fill the gap.
Key Features
FVG Detection:
Identifies bullish FVGs: Occur when the high of a candle two bars prior is lower than the low of the current candle, with the middle candle being bullish (close > open).
Identifies bearish FVGs: Occur when the low of a candle two bars prior is higher than the high of the current candle, with the middle candle being bearish (close < open).
Visualizes FVGs as colored boxes on the chart (green for bullish, red for bearish).
Mitigation Tracking:
Tracks when FVGs are touched (price overlaps the gap range) or mitigated (price fully closes the gap).
Strict Mode: Marks an FVG as mitigated when price touches the gap range.
Normal Mode: Requires a full breakthrough (price crossing the gap’s bottom for bullish FVGs or top for bearish FVGs) for mitigation.
Optionally converts FVG box borders to dashed lines and increases transparency when partially touched.
Multi-Timeframe (MTF) Support:
Analyzes FVGs on three user-defined higher timeframes (default: 15m, 60m, 240m).
Displays MTF FVGs with distinct labels and slightly more transparent colors.
Ensures no duplicate processing of MTF bars to maintain performance.
Customization Options:
FVG Length: Adjustable duration for how long FVGs are displayed (default: 20 bars).
Show/Hide FVGs: Toggle visibility for main timeframe and each MTF.
Color Customization: User-defined colors for bullish and bearish FVGs (default: green and red).
Display Options: Toggle for showing dashed lines after partial touches and strict mitigation mode.
Performance Optimization:
Limits the number of displayed boxes (50 for main timeframe, 20 per MTF) to prevent performance issues.
Automatically removes older boxes to maintain a clean chart.
Functionality
Visualization: Draws boxes around detected FVGs, with customizable colors and text labels ("FVG" for main timeframe, "FVG [timeframe]" for MTF).
Dynamic Updates: Extends or terminates FVG boxes based on mitigation status and user settings.
Efficient Storage: Uses arrays to manage FVG data (boxes, tops, bottoms, indices, mitigation status, and touch status) separately for main and MTF analyses.
Use Case
This indicator is designed for traders using Smart Money Concepts (SMC) to identify areas of market inefficiency (FVGs) for potential price reversals or continuations. The MTF support allows analysis across different timeframes, aiding in confirming trends or spotting higher-timeframe support/resistance zones.
Overview
The "SMC Analysis - Fair Value Gaps (Enhanced)" script, written in Pine Script (version 6), is a technical analysis indicator designed for TradingView to identify and visualize Fair Value Gaps (FVGs) on a price chart. It supports both the main timeframe and multiple higher timeframes (MTF) for comprehensive market analysis. FVGs are price gaps formed by a three-candle pattern, indicating potential areas of market inefficiency where price may return to fill the gap.
Key Features
FVG Detection:
Identifies bullish FVGs: Occur when the high of a candle two bars prior is lower than the low of the current candle, with the middle candle being bullish (close > open).
Identifies bearish FVGs: Occur when the low of a candle two bars prior is higher than the high of the current candle, with the middle candle being bearish (close < open).
Visualizes FVGs as colored boxes on the chart (green for bullish, red for bearish).
Mitigation Tracking:
Tracks when FVGs are touched (price overlaps the gap range) or mitigated (price fully closes the gap).
Strict Mode: Marks an FVG as mitigated when price touches the gap range.
Normal Mode: Requires a full breakthrough (price crossing the gap’s bottom for bullish FVGs or top for bearish FVGs) for mitigation.
Optionally converts FVG box borders to dashed lines and increases transparency when partially touched.
Multi-Timeframe (MTF) Support:
Analyzes FVGs on three user-defined higher timeframes (default: 15m, 60m, 240m).
Displays MTF FVGs with distinct labels and slightly more transparent colors.
Ensures no duplicate processing of MTF bars to maintain performance.
Customization Options:
FVG Length: Adjustable duration for how long FVGs are displayed (default: 20 bars).
Show/Hide FVGs: Toggle visibility for main timeframe and each MTF.
Color Customization: User-defined colors for bullish and bearish FVGs (default: green and red).
Display Options: Toggle for showing dashed lines after partial touches and strict mitigation mode.
Performance Optimization:
Limits the number of displayed boxes (50 for main timeframe, 20 per MTF) to prevent performance issues.
Automatically removes older boxes to maintain a clean chart.
Functionality
Visualization: Draws boxes around detected FVGs, with customizable colors and text labels ("FVG" for main timeframe, "FVG [timeframe]" for MTF).
Dynamic Updates: Extends or terminates FVG boxes based on mitigation status and user settings.
Efficient Storage: Uses arrays to manage FVG data (boxes, tops, bottoms, indices, mitigation status, and touch status) separately for main and MTF analyses.
Use Case
This indicator is designed for traders using Smart Money Concepts (SMC) to identify areas of market inefficiency (FVGs) for potential price reversals or continuations. The MTF support allows analysis across different timeframes, aiding in confirming trends or spotting higher-timeframe support/resistance zones.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.