OPEN-SOURCE SCRIPT
FVG & OB [odnac]

This indicator is a sophisticated tool designed for Smart Money Concepts (SMC) traders. It automates the detection of two critical institutional footprints: Order Blocks (OB) and Fair Value Gaps (FVG), with a focus on candle momentum and mitigation tracking.
Key Features
Technical Logic Breakdown
Detection Logic
Key Features
1. Advanced Momentum Filtering (3 Versions)
Unlike basic indicators, this script uses three different mathematical approaches to ensure the middle candle represents a "strong" move:
- V1 (Body Focus): Compares the bodies of the surrounding candles to the middle candle.
- V2 (Hybrid): Uses a mix of candle ranges and bodies to identify expansion.
- V3 (Range Focus): The most aggressive filter; it ensures the total range of the middle candle dwarfs the surrounding candles.
2. Automatic Mitigation Tracking
The indicator doesn't just draw static boxes. It tracks price action in real-time:
- Dynamic Extension: Boxes extend to the right automatically as long as price has not returned to "test" or "fill" the zone.
- Smart Clean-up: Once the price touches the zone (Mitigation), the box stops extending or is removed. This keeps your chart clean and focused only on "fresh" (unmitigated) levels.
3. Smart Money Concept Integration
- Order Blocks (White Boxes): Identifies where institutional buying or selling occurred before a strong move.
- Fair Value Gaps (Yellow Boxes): Highlights price imbalances where the market moved too fast, leaving a gap that often acts as a magnet for future price action.
Technical Logic Breakdown
Detection Logic
The script looks at a 3-candle sequence:
- Candle [2] (The Origin): Defines the boundary of the OB or FVG.
- Candle [1] (The Expansion): Must be a "Strong Candle" based on your selected setting (V1, V2, or V3).
- Candle [0] (The Confirmation): Ensures that the "Tail Gap" condition is met (the wick of Candle 2 and Candle 0 do not touch).
Box Management
The script uses Pine Script Arrays to manage up to 500 boxes. It constantly loops through active boxes to check:
- Time Limit: If a box exceeds the max_bars_extend limit, it is removed to save memory.
- Price Touch: If low or high enters the box coordinates, the zone is considered "mitigated" and the extension stops.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。