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
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。