OPEN-SOURCE SCRIPT
Michael's FVG Detector

═══════════════════════════════════════
Michael's FVG Detector
═══════════════════════════════════════
A clean and efficient Fair Value Gap (FVG) indicator for TradingView that helps traders identify market imbalances with precision.
───────────────────────────────────────
Overview
───────────────────────────────────────
Fair Value Gaps (FVGs) are price inefficiencies that occur when there's a gap between the wicks of candlesticks, indicating rapid price movement with minimal trading activity. These gaps often act as support/resistance zones where price may return to "fill the gap."
This indicator automatically detects and visualizes both bullish and bearish FVGs on any timeframe, making it easy to spot potential trading opportunities.
───────────────────────────────────────
Features
───────────────────────────────────────
Core Functionality
Customization
Performance Optimization
───────────────────────────────────────
How It Works
───────────────────────────────────────
Detection Logic
Bullish FVG:
Bearish FVG:
Visual Display
Each detected FVG is displayed as:
───────────────────────────────────────
Performance Notes
───────────────────────────────────────
───────────────────────────────────────
Disclaimer
───────────────────────────────────────
This indicator is for educational and informational purposes only. It is not financial advice. Always do your own research and risk management before making trading decisions.
───────────────────────────────────────
Author: Michael
Version: 1.0
License: Free for personal use
Last Updated: November 2025
Michael's FVG Detector
═══════════════════════════════════════
A clean and efficient Fair Value Gap (FVG) indicator for TradingView that helps traders identify market imbalances with precision.
───────────────────────────────────────
Overview
───────────────────────────────────────
Fair Value Gaps (FVGs) are price inefficiencies that occur when there's a gap between the wicks of candlesticks, indicating rapid price movement with minimal trading activity. These gaps often act as support/resistance zones where price may return to "fill the gap."
This indicator automatically detects and visualizes both bullish and bearish FVGs on any timeframe, making it easy to spot potential trading opportunities.
───────────────────────────────────────
Features
───────────────────────────────────────
Core Functionality
- Automatic FVG Detection: Identifies Fair Value Gaps in real-time as they form
- Bullish & Bearish FVGs: Detects both upward and downward price gaps
- 3-Candle Pattern: Uses classic FVG logic (current candle low > high from 2 bars ago for bullish, vice versa for bearish)
- Gap Size Display: Shows the exact size of each FVG in ticks directly on the box
- Confirmed Bars Only: Only draws FVGs on confirmed bars to prevent repainting
Customization
- Color Settings: Fully customizable colors for bullish and bearish FVGs with transparency control
- Text Color: Configurable color for the tick size labels
- Default Styling: Comes with sensible defaults (20% transparency, dark gray labels)
Performance Optimization
- Smart Cleanup: Automatically removes boxes outside the visible chart area
- Efficient Rendering: Maintains optimal performance even on lower timeframes
- No Repainting: Uses confirmed bars only for reliable signals
───────────────────────────────────────
How It Works
───────────────────────────────────────
Detection Logic
Bullish FVG:
- Current bar's low is higher than the high from 2 bars ago
- Creates an upward gap that price left behind during bullish momentum
Bearish FVG:
- Current bar's high is lower than the low from 2 bars ago
- Creates a downward gap that price left behind during bearish momentum
Visual Display
Each detected FVG is displayed as:
- A semi-transparent colored box spanning the gap area
- The box extends from bar -2 to the current bar
- Gap size in ticks shown at the bottom-left of each box
- Singular/plural formatting ("1 tick" vs "X ticks")
───────────────────────────────────────
Performance Notes
───────────────────────────────────────
- Cleanup runs every 50 bars to maintain optimal performance
- Only creates boxes on confirmed bars (no real-time repainting)
- Efficiently manages memory by removing off-screen boxes
- Suitable for both manual and automated trading strategies
───────────────────────────────────────
Disclaimer
───────────────────────────────────────
This indicator is for educational and informational purposes only. It is not financial advice. Always do your own research and risk management before making trading decisions.
───────────────────────────────────────
Author: Michael
Version: 1.0
License: Free for personal use
Last Updated: November 2025
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.