OPEN-SOURCE SCRIPT
HTF FVGs (UDT) [CantoLab]

A multi-timeframe extension of the FVG Detector (UDT) — plots Fair Value Gaps across up to 6 timeframes at once, still built the same way: using User-Defined Types (UDTs) so the detection, drawing, mitigation, and state-tracking logic are all just function/method calls instead of repeated inline logic.
What's different from the single-timeframe version
Instead of writing a separate request.security call for each timeframe, this uses a single reusable function that takes a timeframe as a parameter and is looped through for all 6 timeframes.
It also adds a getBar function, this solves a specific problem with HTF FVGs: the gap is detected on the higher timeframe, but if you just use the HTF bar's open time to place the box, it doesn't line up with the actual candle that created the high or low. getBar walks forward through the lower-timeframe bars to find the exact candle that produced that price, so the FVG box is drawn precisely where the gap actually formed.
Everything else is the same as the FVG Detector :
Standard 3-candle FVG detection
Boxes with optional border, mid-line, and labels
Mitigated FVGs are removed automatically, with an option to keep them visible in a muted state
Settings
- Universal FVG Color — one color for all timeframes, or a separate color per timeframe
- Labels — toggle, size, color
- Border — toggle, color
- Mid Line — toggle, color, style, width
- Timeframe 1–6 — individually toggle, set timeframe, set color
Notes
- Open source — feel free to study, reuse, or build on this
- This indicator does not provide financial advice. You are responsible for how you build around and execute on this information
What's different from the single-timeframe version
Instead of writing a separate request.security call for each timeframe, this uses a single reusable function that takes a timeframe as a parameter and is looped through for all 6 timeframes.
It also adds a getBar function, this solves a specific problem with HTF FVGs: the gap is detected on the higher timeframe, but if you just use the HTF bar's open time to place the box, it doesn't line up with the actual candle that created the high or low. getBar walks forward through the lower-timeframe bars to find the exact candle that produced that price, so the FVG box is drawn precisely where the gap actually formed.
Everything else is the same as the FVG Detector :
Standard 3-candle FVG detection
Boxes with optional border, mid-line, and labels
Mitigated FVGs are removed automatically, with an option to keep them visible in a muted state
Settings
- Universal FVG Color — one color for all timeframes, or a separate color per timeframe
- Labels — toggle, size, color
- Border — toggle, color
- Mid Line — toggle, color, style, width
- Timeframe 1–6 — individually toggle, set timeframe, set color
Notes
- Open source — feel free to study, reuse, or build on this
- This indicator does not provide financial advice. You are responsible for how you build around and execute on this information
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.