OPEN-SOURCE SCRIPT

ICT iFVG Detector and Alert [by ote618]

2 647
Description
This script detects ICT - fair value gaps (FVG) formed by price gaps between Candle 1 and Candle 3, then monitors the next 5 candles for an inverse fair value gap (iFVG).

What It Detects
Bullish FVG: When Candle 1 high is below Candle 3 low (BISI)
Bearish FVG: When Candle 1 low is above Candle 3 high (SIBI)

Once an FVG is detected, the script checks the next 5 candles:

A Bullish FVG becomes a Bearish IFVG if price closes below Candle 1 high
A Bearish FVG becomes a Bullish IFVG if price closes above Candle 1 low

Only the first bar that validates the FVG triggers the transition to an IFVG.

Visual Output
A shaded rectangle is plotted to mark the original FVG zone (from Candle 1 to Candle 3)

Color-coded:
Red for Bearish IFVG (validated Bullish IG)
Green for Bullish IFVG (validated Bearish IG)

The rectangle extends from Candle 1 to the validating bar

Alerts
You can receive alerts when an FVG becomes an IFVG:

Configurable to fire only on selected timeframes (1m, 5m, 15m, 60m)
Alerts include the direction and the chart timeframe

Settings
Enable Alerts For Timeframe: Choose which timeframe(s) trigger alerts

This tool helps traders identify inverse FVGs (iFVG), a useful ICT concept.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.