OPEN-SOURCE SCRIPT

FVG & OB [odnac]

242
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

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:
  1. Candle [2] (The Origin): Defines the boundary of the OB or FVG.
  2. Candle [1] (The Expansion): Must be a "Strong Candle" based on your selected setting (V1, V2, or V3).
  3. 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. קרא עוד ב־תנאי השימוש.