OPEN-SOURCE SCRIPT
已更新

IFVG by Toño

570
# IFVG by Toño - Pine Script Indicator

## Overview
This Pine Script indicator identifies and visualizes **Fair Value Gaps (FVG)** and **Inverted Fair Value Gaps (IFVG)** on trading charts. It provides advanced analysis of price inefficiencies and their subsequent inversions when mitigated.

## Key Features

### 1. Fair Value Gap (FVG) Detection
- **Bullish FVG**: Detected when `low > high[2]` (gap between current low and high of 2 bars ago)
- **Bearish FVG**: Detected when `high < low[2]` (gap between current high and low of 2 bars ago)
- Visual representation using colored rectangles (green for bullish, red for bearish)

### 2. Inverted Fair Value Gap (IFVG) Creation
- **IFVG Formation**: When a FVG gets mitigated (price fills the gap with candle body), an IFVG is created
- **Color Inversion**: The IFVG takes the opposite color of the original FVG
- Mitigated bullish FVG → Creates red (bearish) IFVG
- Mitigated bearish FVG → Creates green (bullish) IFVG
- **Mitigation Logic**: Uses only candle body (not wicks) to determine when a FVG is filled

### 3. Customizable Display Options
- **Show Normal FVG**: Toggle visibility of regular Fair Value Gaps
- **Show IFVG**: Toggle visibility of Inverted Fair Value Gaps
- **Smart FVG Display**: Even when "Show Normal FVG" is disabled, FVGs that are part of IFVGs remain visible
- **Extension Control**: Option to extend FVGs until they are mitigated

### 4. IFVG Extension Methods
- **Full Cross Method**: IFVG remains active until price completely crosses through it (including wicks)
- **Number of Bars Method**: IFVG remains active for a specified number of bars (1-100)

### 5. Visual Mitigation Signals
- **Cross Markers**: Shows X-shaped markers when IFVGs are mitigated
- Green cross above bar: Bearish IFVG mitigated
- Red cross below bar: Bullish IFVG mitigated

### 6. Comprehensive Alert System
- **IFVG Formation Alerts**: Notifications when new IFVGs are created
- **IFVG Mitigation Alerts**: Notifications when IFVGs are filled/mitigated
- **Separate Controls**: Individual toggles for bullish and bearish IFVG alerts

## How It Works

### Step-by-Step Process:
1. **FVG Detection**: Script continuously scans for 3-bar patterns that create price gaps
2. **FVG Tracking**: Each FVG is stored with its coordinates, type, and status
3. **Mitigation Monitoring**: Script watches for candle bodies that fill the FVG
4. **IFVG Creation**: Upon mitigation, creates an IFVG with opposite polarity at the same location
5. **IFVG Management**: Tracks and extends IFVGs according to chosen method
6. **Visual Updates**: Dynamically updates colors and visibility based on user settings

## Use Cases
- **Support/Resistance Analysis**: IFVGs often act as strong support/resistance levels
- **Market Structure Understanding**: Helps identify how market inefficiencies get filled and reversed
- **Entry/Exit Timing**: Can be used to time entries around IFVG formations or mitigations
- **Confluence Analysis**: Combine with other technical analysis tools for stronger signals

## Configuration Parameters
- **Colors**: Customizable colors for bullish/bearish FVGs and IFVGs
- **Extension**: Choose how long to display gaps on the chart
- **Alerts**: Full control over notification preferences
- **Visual Clarity**: Options to show/hide different gap types for cleaner charts

## Technical Specifications
- **Pine Script Version**: 5
- **Overlay**: True (displays directly on price chart)
- **Max Boxes**: 500 (supports up to 500 simultaneous gaps)
- **Performance**: Optimized array management for smooth operation

This indicator is particularly valuable for traders who use **Smart Money Concepts (SMC)** and **Inner Circle Trader (ICT)** methodologies, as it provides clear visualization of how institutional order flow creates and fills market inefficiencies.
發行說明
# IFVG by Toño - Pine Script Indicator

## Overview
This Pine Script indicator identifies and visualizes **Fair Value Gaps (FVG)** and **Inverted Fair Value Gaps (IFVG)** on trading charts. It provides advanced analysis of price inefficiencies and their subsequent inversions when mitigated.

## Key Features

### 1. Fair Value Gap (FVG) Detection
- **Bullish FVG**: Detected when `low > high[2]` (gap between current low and high of 2 bars ago)
- **Bearish FVG**: Detected when `high < low[2]` (gap between current high and low of 2 bars ago)
- Visual representation using colored rectangles (green for bullish, red for bearish)

### 2. Inverted Fair Value Gap (IFVG) Creation
- **IFVG Formation**: When a FVG gets mitigated (price fills the gap with candle body), an IFVG is created
- **Color Inversion**: The IFVG takes the opposite color of the original FVG
- Mitigated bullish FVG → Creates red (bearish) IFVG
- Mitigated bearish FVG → Creates green (bullish) IFVG
- **Mitigation Logic**: Uses only candle body (not wicks) to determine when a FVG is filled

### 3. Customizable Display Options
- **Show Normal FVG**: Toggle visibility of regular Fair Value Gaps
- **Show IFVG**: Toggle visibility of Inverted Fair Value Gaps
- **Smart FVG Display**: Even when "Show Normal FVG" is disabled, FVGs that are part of IFVGs remain visible
- **Extension Control**: Option to extend FVGs until they are mitigated

### 4. IFVG Extension Methods
- **Full Cross Method**: IFVG remains active until price completely crosses through it (including wicks)
- **Number of Bars Method**: IFVG remains active for a specified number of bars (1-100)

### 5. Visual Mitigation Signals
- **Cross Markers**: Shows X-shaped markers when IFVGs are mitigated
- Green cross above bar: Bearish IFVG mitigated
- Red cross below bar: Bullish IFVG mitigated

### 6. Comprehensive Alert System
- **IFVG Formation Alerts**: Notifications when new IFVGs are created
- **IFVG Mitigation Alerts**: Notifications when IFVGs are filled/mitigated
- **Separate Controls**: Individual toggles for bullish and bearish IFVG alerts

## How It Works

### Step-by-Step Process:
1. **FVG Detection**: Script continuously scans for 3-bar patterns that create price gaps
2. **FVG Tracking**: Each FVG is stored with its coordinates, type, and status
3. **Mitigation Monitoring**: Script watches for candle bodies that fill the FVG
4. **IFVG Creation**: Upon mitigation, creates an IFVG with opposite polarity at the same location
5. **IFVG Management**: Tracks and extends IFVGs according to chosen method
6. **Visual Updates**: Dynamically updates colors and visibility based on user settings

## Use Cases
- **Support/Resistance Analysis**: IFVGs often act as strong support/resistance levels
- **Market Structure Understanding**: Helps identify how market inefficiencies get filled and reversed
- **Entry/Exit Timing**: Can be used to time entries around IFVG formations or mitigations
- **Confluence Analysis**: Combine with other technical analysis tools for stronger signals

## Configuration Parameters
- **Colors**: Customizable colors for bullish/bearish FVGs and IFVGs
- **Extension**: Choose how long to display gaps on the chart
- **Alerts**: Full control over notification preferences
- **Visual Clarity**: Options to show/hide different gap types for cleaner charts

## Technical Specifications
- **Pine Script Version**: 5
- **Overlay**: True (displays directly on price chart)
- **Max Boxes**: 500 (supports up to 500 simultaneous gaps)
- **Performance**: Optimized array management for smooth operation

This indicator is particularly valuable for traders who use **Smart Money Concepts (SMC)** and **Inner Circle Trader (ICT)** methodologies, as it provides clear visualization of how institutional order flow creates and fills market inefficiencies.

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。