OPEN-SOURCE SCRIPT
IFVG Extended (simple)

This is an indicator that identifies and visualizes Inverted Fair Value Gaps (IFVG) on price charts. Here's what it does:
Core Functionality
Fair Value Gap (FVG) Detection:
Identifies bullish FVGs when current low is above the high from 2 bars ago
Identifies bearish FVGs when current high is below the low from 2 bars ago
Filters gaps using an ATR-based minimum size threshold
Inversion Tracking:
Monitors when price breaks back through identified FVGs (inversions)
Tracks the state transition from FVG to inverted FVG
Generates signals when price reacts to inverted zones
Key Features
Visual Elements:
Displays up to 500 boxes, lines, and labels on the chart
Shows the last N FVGs (configurable, default 5)
Color-coded zones: green for bullish, red for bearish
Dashed midlines through each gap
Triangle markers (▲/▼) indicating signal triggers
User Inputs:
Show Last: Number of recent IFVGs to display (1-100)
Signal Preference: Choose between "Close" or "Wick" for signal detection
ATR Multiplier: Minimum gap size filter (0.25 default)
Customizable colors for bull/bear zones and midlines
Signal Logic:
Bullish signal: Price closes above inverted bearish FVG after previously breaking below it
Bearish signal: Price closes below inverted bullish FVG after previously breaking above it
Includes alertconditions for automated notifications
Technical Implementation
Uses custom types (fvg and lab) to store gap data, manages arrays of active and inverted FVGs, and dynamically redraws all visual elements on the last bar to maintain clean chart presentation.
Core Functionality
Fair Value Gap (FVG) Detection:
Identifies bullish FVGs when current low is above the high from 2 bars ago
Identifies bearish FVGs when current high is below the low from 2 bars ago
Filters gaps using an ATR-based minimum size threshold
Inversion Tracking:
Monitors when price breaks back through identified FVGs (inversions)
Tracks the state transition from FVG to inverted FVG
Generates signals when price reacts to inverted zones
Key Features
Visual Elements:
Displays up to 500 boxes, lines, and labels on the chart
Shows the last N FVGs (configurable, default 5)
Color-coded zones: green for bullish, red for bearish
Dashed midlines through each gap
Triangle markers (▲/▼) indicating signal triggers
User Inputs:
Show Last: Number of recent IFVGs to display (1-100)
Signal Preference: Choose between "Close" or "Wick" for signal detection
ATR Multiplier: Minimum gap size filter (0.25 default)
Customizable colors for bull/bear zones and midlines
Signal Logic:
Bullish signal: Price closes above inverted bearish FVG after previously breaking below it
Bearish signal: Price closes below inverted bullish FVG after previously breaking above it
Includes alertconditions for automated notifications
Technical Implementation
Uses custom types (fvg and lab) to store gap data, manages arrays of active and inverted FVGs, and dynamically redraws all visual elements on the last bar to maintain clean chart presentation.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.