OPEN-SOURCE SCRIPT
FVG + Swings + Configurable

Overview
This Pine Script v5 indicator highlights Fair Value Gaps (FVGs), plots swing‑high and swing‑low pivots, and marks single breakouts above the last swing‑high or below the last swing‑low by recoloring the breakout candle. Every aspect—gap size, count limits, colors, and feature toggles—is exposed as an input so you can tailor it to your own workflow.
Key Features
Fair Value Gaps
Detects bullish gaps when the high of bar i-2 is below the low of the current bar.
Detects bearish gaps when the low of bar i-2 is above the high of the current bar.
Draws a semi‑transparent rectangle spanning from bar i-2 to bar i + extension.
Automatically deletes oldest boxes when exceeding the user’s “Max FVG Boxes” limit.
Swing‑High / Swing‑Low Pivots
Identifies a swing‑high when the middle candle of a three‑bar sequence has the highest high.
Identifies a swing‑low when the middle candle has the lowest low.
Marks each pivot with a tiny dot above (high) or below (low) the bar.
Single Breakouts
Tracks the most recent swing‑high and swing‑low levels.
On the first close above the last swing‑high (or below the last swing‑low), recolors that single candle.
Prevents repeated coloring until a new swing pivot forms.
Full Customization
Show/Hide toggles for FVGs, swing pivots, breakouts.
Numeric inputs for FVG extension length and maximum retained boxes.
Color pickers for bullish/bearish gaps, swing pivots, and breakout candles.
This Pine Script v5 indicator highlights Fair Value Gaps (FVGs), plots swing‑high and swing‑low pivots, and marks single breakouts above the last swing‑high or below the last swing‑low by recoloring the breakout candle. Every aspect—gap size, count limits, colors, and feature toggles—is exposed as an input so you can tailor it to your own workflow.
Key Features
Fair Value Gaps
Detects bullish gaps when the high of bar i-2 is below the low of the current bar.
Detects bearish gaps when the low of bar i-2 is above the high of the current bar.
Draws a semi‑transparent rectangle spanning from bar i-2 to bar i + extension.
Automatically deletes oldest boxes when exceeding the user’s “Max FVG Boxes” limit.
Swing‑High / Swing‑Low Pivots
Identifies a swing‑high when the middle candle of a three‑bar sequence has the highest high.
Identifies a swing‑low when the middle candle has the lowest low.
Marks each pivot with a tiny dot above (high) or below (low) the bar.
Single Breakouts
Tracks the most recent swing‑high and swing‑low levels.
On the first close above the last swing‑high (or below the last swing‑low), recolors that single candle.
Prevents repeated coloring until a new swing pivot forms.
Full Customization
Show/Hide toggles for FVGs, swing pivots, breakouts.
Numeric inputs for FVG extension length and maximum retained boxes.
Color pickers for bullish/bearish gaps, swing pivots, and breakout candles.
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.
For quick access on a chart, add this script to your favorites — learn more here.
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.
For quick access on a chart, add this script to your favorites — learn more here.
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.