It’s open-sourced as a reference for other developers (and non-developers curious about the code) on how to structure indicator logic using User-Defined Types (UDTs).
This is my attempt at a clean, minimal, properly organized version of FVG detection logic
Why UDTs?
UDT – user defined types
Normally, FVG detection is written inline wherever it’s needed:
bullFVG = low[1] > high[3]
bearFVG = high[1] < low[3]
This works fine for a small script, but in larger, more complex indicators — the kind that span thousands of lines and check for patterns across many different bar indexes — repeating this logic everywhere gets messy fast.
With a UDT, the FVG becomes a defined structure (top, bottom, kind, indexes, drawings, etc.), and the detection logic becomes a single function. Instead of rewriting the comparison every time, you just call the function and pass in a bar index — it returns the same result. The same approach is used for plotting: drawing, mitigating, and deleting an FVG are each just method calls on the type.
This cuts what would normally be repeated blocks of logic down to just a few reusable lines, and keeps larger scripts far more organized and readable.
What it actually does
– Detects standard 3-candle bullish and bearish FVGs
– Plots them as boxes, with optional borders, mid-line, and labels
– Tracks each FVG and checks for mitigation every bar
– Mitigated FVGs are removed by default, with an option to keep them visible in a muted “failed” state instead
Settings
– Labels — toggle, size, color
– Bull FVG / Bear FVG — toggle, color, optional border
– Mid Line — toggle, color, style, width
– Show Mitigated FVGs — toggle, 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
Source link
Author

- Ytv Market News
- Share-market news writer and analyst with deep experience covering equities, commodities, forex, and cryptocurrencies for readers in the USA, UK, Canada, and Australia. Ytv Market News delivers timely market updates, practical trading insights, and clear explanations of macro and company-level catalysts that move prices. Combines on-the-ground financial reporting with technical analysis, using concise charts and actionable ideas to help investors and traders make smarter decisions.
Latest entries
Crypto NewsAugust 26, 2026Bernstein sees bitcoin reaching $150,000 by mid-2027 amid 'debasement trade,' but cuts Strategy target to $350
Commodities NewsAugust 26, 2026India’s Russian Oil Imports Slide From Record High as Supply Tightens
Investing InsightsAugust 26, 2026First-Time Home Purchase Tax Break Extended to Officetels; Young Buyers Get Up to 3 Million Won in Relief — BigGo Finance
GermanyAugust 26, 2026Some Chinese workers see an ally in Brussels as EU trade tensions mount
