OPEN-SOURCE SCRIPT
Diupdate

FVG Size

360
FVG Size Indicator – Description
Overview
This Pine Script v5 indicator detects and visualizes Fair Value Gaps (FVGs) on the chart. It draws colored boxes for FVGs, center lines (CE), and displays the size of each FVG as a label. The indicator is designed for manual analysis, helping traders identify potential price imbalances.

Key Features


FVG Detection:

Identifies bullish and bearish FVGs based on price structure.
Draws colored boxes for FVGs and dotted center lines (CE).



FVG Size Display:

Shows the size of each FVG as a label inside the box.
Customizable minimum size threshold to filter out smaller FVGs.



Dynamic Adjustments:

Extends FVG boxes to the right as new bars form.
Removes FVGs that are filled (mitigated) by price action.



Customizable Settings:

Adjustable colors, text size, and display options.




Settings and Translations
Here are the German settings with their English translations:
FVG Settings

Long FVG Farbe → Long FVG Color (Color for bullish FVG boxes)
Short FVG Farbe → Short FVG Color (Color for bearish FVG boxes)
CE Farbe → CE Color (Color for the center line)
Tage Rückblick → Lookback Days (Number of days to look back for FVGs)
Lösche gefüllte Boxen & Linien → Delete Filled Boxes & Lines (Removes FVGs that have been filled by price)

FVG Display

FVG Größe anzeigen → Show FVG Size (Displays the size of each FVG as a label)
Text → Text Size (Size of the FVG size label text)
Mindestgröße → Minimum Size (Minimum FVG size to display, filtering out smaller FVGs)


How It Works


FVG Detection Logic:

A bullish FVG is detected if the high of the 3rd bar is lower than the low of the 1st bar.
A bearish FVG is detected if the low of the 3rd bar is higher than the high of the 1st bar.



Drawing FVGs:

The indicator draws a box between the high/low of the 1st and 3rd bars.
A center line (CE) is drawn at the midpoint of the FVG.
The size of the FVG is displayed as a label inside the box.



Dynamic Adjustments:

FVG boxes are extended to the right as new bars form.
If the price fills the FVG, the box and line are removed (depending on settings).



Mitigation Logic:

If the price closes beyond the FVG boundaries, the FVG is considered "filled" and removed.
Catatan Rilis
FVG Size Indicator – Description (English)

Changelog
10/04/2025 – Version 4.10.25 (Bugfix)
Fixed: CE lines were incorrectly appearing on non-FVG candles. Now, CE lines are only drawn on valid FVG candles.


Overview
This Pine Script v6 indicator detects and visualizes Fair Value Gaps (FVGs) on the chart. It draws colored boxes for FVGs, center lines (CE), and displays the size of each FVG as a label. The indicator is designed for manual analysis, helping traders identify potential price imbalances.


++++ New in Version 6 ++++
Fixed Bug: In the previous version, CE lines (Center Lines) were incorrectly drawn on candles that did not have an FVG. This bug has been fixed, so CE lines now only appear on actual FVG candles.


Key Features

FVG Detection:
Identifies bullish and bearish FVGs based on price structure.
Draws colored boxes for FVGs and dotted center lines (CE).


FVG Size Display:
Shows the size of each FVG as a label inside the box.
Customizable minimum size threshold to filter out smaller FVGs.


Dynamic Adjustments:
Extends FVG boxes to the right as new bars form.
Removes FVGs that are filled (mitigated) by price action.


Customizable Settings:
Adjustable colors, text size, and display options.


Settings and Translations
Long FVG Farbe: Color for bullish FVG boxes (Long FVG Color).
Short FVG Farbe: Color for bearish FVG boxes (Short FVG Color).
CE Farbe: Color for the center line (CE Color).
Tage Rückblick: Number of days to look back for FVGs (Lookback Days).
Lösche gefüllte Boxen & Linien: Removes FVGs that have been filled by price (Delete Filled Boxes & Lines).
FVG Größe anzeigen: Displays the size of each FVG as a label (Show FVG Size).
Text: Size of the FVG size label text (Text Size).
Mindestgröße: Minimum FVG size to display, filtering out smaller FVGs (Minimum Size).

How It Works

FVG Detection Logic:
A bullish FVG is detected if the high of the 3rd bar is lower than the low of the 1st bar.
A bearish FVG is detected if the low of the 3rd bar is higher than the high of the 1st bar.


Drawing FVGs:
The indicator draws a box between the high/low of the 1st and 3rd bars.
A center line (CE) is drawn at the midpoint of the FVG.
The size of the FVG is displayed as a label inside the box.


Dynamic Adjustments:
FVG boxes are extended to the right as new bars form.
If the price fills the FVG, the box and line are removed (depending on settings).


Mitigation Logic:
If the price closes beyond the FVG boundaries, the FVG is considered "filled" and removed.
Catatan Rilis
FVG Size Indicator – Version 7 (Bugfix of Previous Bugfix)

04/11/2025 – Version 7
In Version 6, a bug was fixed where CE lines (Center Lines) appeared on candles without valid FVGs.
However, that fix itself was incomplete: in some cases, CE lines did not appear on all valid FVG boxes or disappeared too early.
Version 7 corrects that faulty fix. CE lines are now displayed reliably and exclusively inside valid FVG boxes, and are properly removed once the FVG is mitigated.

Overview

This Pine Script v6 indicator detects and visualizes Fair Value Gaps (FVGs) on the chart.
It draws colored boxes for FVGs, adds a dotted center line (CE), and displays the size of each FVG as a label.
The indicator is designed for manual analysis, helping traders identify potential price imbalances.

New and Corrected Features

Bugfix of previous bugfix – fixes the issue from Version 6 where CE lines were incomplete or incorrectly displayed.
CE lines now appear reliably and only inside valid FVG boxes.
Improved synchronization between boxes and lines during extension or removal.
General code optimization and better performance.

Key Features

FVG Detection – identifies bullish and bearish FVGs based on price structure.
Draws colored boxes and dotted center lines (CE).

FVG Size Display – shows the size of each FVG as a label inside the box.
Customizable minimum size threshold to filter out small gaps.

Dynamic Adjustments – boxes and lines automatically extend to the right as long as the gap remains open.
When the gap is filled, both the box and the line are automatically removed.

Customizable Settings – adjustable colors, text size, and display options.

Settings and Translations

FVG Einstellungen / FVG Settings (Main section for FVG configuration)
Long FVG Farbe / Long FVG Color (Color for bullish FVG boxes)
Short FVG Farbe / Short FVG Color (Color for bearish FVG boxes)
CE Linie / CE Line Color (Color for the dotted center line)
Rückblick / Lookback Days (Number of days to look back for FVGs)
Lösche gefüllte / Delete Filled (Automatically removes filled / mitigated FVG boxes)

FVG Anzeige / FVG Display (Display and visualization options)
FVG Größe anzeigen / Show FVG Size (Displays the size of each FVG as a label inside the box)
Text / Text Size (Font size of the FVG size label)
Mindestgröße / Minimum Size (Minimum FVG size to display)
Textfarbe / Text Color (Color of the label text)
Transparenz / Transparency (Transparency of the FVG boxes, 0 = opaque / 100 = invisible)

How It Works

FVG Detection Logic – a bullish FVG occurs when the high of the 3rd candle is lower than the low of the 1st candle.
A bearish FVG occurs when the low of the 3rd candle is higher than the high of the 1st candle.

Drawing FVGs – the indicator draws a box between the highs / lows of the 1st and 3rd candles.
A dotted CE line is placed at the midpoint of the box.
The size of the FVG is displayed as a label inside the box.

Dynamic Extension and Removal – boxes and lines extend automatically as long as the FVG remains open.
When price fills the FVG (mitigation), the box and CE line are removed (or hidden, depending on user settings).

Mitigation Logic

If the price closes beyond the FVG boundaries (above for bullish, below for bearish), the FVG is considered “filled” and is removed.

Disclaimer

This script is for analysis and educational purposes only and does not constitute financial, investment, or trading advice.
Use at your own risk.

Pernyataan Penyangkalan

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.