OPEN-SOURCE SCRIPT
FVG Pilot

What it does
Automatically detects and draws Fair Value Gaps (FVGs) on the chart.
Removes an FVG as soon as it’s invalidated (bullish FVG invalid if price closes below its lower bound; bearish FVG invalid if price closes above its upper bound).
Triggers alerts only during Silver Bullet (SB) sessions in Europe/Berlin time when a new FVG is created.
Optionally draws two thin vertical lines at the start and end of each SB session so you can see the windows at a glance.
Runs on confirmed bars to avoid repainting.
How FVGs are detected
Wick mode (default):
Bullish FVG when low > high[2] → gap [high[2], low]
Bearish FVG when high < low[2] → gap [high, low[2]]
Body mode (optional): uses candle bodies instead of wicks:
Bullish FVG when current body low > prior body high
Bearish FVG when current body high < prior body low
Silver Bullet sessions (Europe/Berlin)
Three configurable session windows (default examples):
SB1: 10:00–11:00
SB2: 02:00–03:00
SB3: 07:00–08:00
Alerts for new FVGs fire only inside these windows.
Session lines: a thin vertical line is drawn on the first bar inside a session (start) and on the first bar after a session (end).
Inputs
Show Bullish / Bearish FVGs
Use Bodies (instead of wicks)
Minimum FVG size (in ticks)
Box opacity
SB sessions: enable/disable each window and set times (Europe/Berlin)
Session line toggle + color/width
Alerts included
SB (Berlin): Bullish FVG created – fires only during SB sessions
SB (Berlin): Bearish FVG created – fires only during SB sessions
Bullish FVG invalidated – fires when a bullish FVG is invalidated (no time filter)
Bearish FVG invalidated – fires when a bearish FVG is invalidated (no time filter)
How to set alerts (TradingView)
Click Create Alert.
Condition: choose this indicator, then pick one of the alert conditions above.
Select your alert options (once per bar close is recommended), then Create.
Tips
If you don’t see boxes, reduce Minimum FVG size or lower opacity (e.g., 70–85).
Body mode is stricter; start with wicks if you want more signals.
SB windows use Europe/Berlin and automatically account for DST.
The script respects platform limits for drawings; if your chart is cluttered, zoom in or reduce active sessions.
Automatically detects and draws Fair Value Gaps (FVGs) on the chart.
Removes an FVG as soon as it’s invalidated (bullish FVG invalid if price closes below its lower bound; bearish FVG invalid if price closes above its upper bound).
Triggers alerts only during Silver Bullet (SB) sessions in Europe/Berlin time when a new FVG is created.
Optionally draws two thin vertical lines at the start and end of each SB session so you can see the windows at a glance.
Runs on confirmed bars to avoid repainting.
How FVGs are detected
Wick mode (default):
Bullish FVG when low > high[2] → gap [high[2], low]
Bearish FVG when high < low[2] → gap [high, low[2]]
Body mode (optional): uses candle bodies instead of wicks:
Bullish FVG when current body low > prior body high
Bearish FVG when current body high < prior body low
Silver Bullet sessions (Europe/Berlin)
Three configurable session windows (default examples):
SB1: 10:00–11:00
SB2: 02:00–03:00
SB3: 07:00–08:00
Alerts for new FVGs fire only inside these windows.
Session lines: a thin vertical line is drawn on the first bar inside a session (start) and on the first bar after a session (end).
Inputs
Show Bullish / Bearish FVGs
Use Bodies (instead of wicks)
Minimum FVG size (in ticks)
Box opacity
SB sessions: enable/disable each window and set times (Europe/Berlin)
Session line toggle + color/width
Alerts included
SB (Berlin): Bullish FVG created – fires only during SB sessions
SB (Berlin): Bearish FVG created – fires only during SB sessions
Bullish FVG invalidated – fires when a bullish FVG is invalidated (no time filter)
Bearish FVG invalidated – fires when a bearish FVG is invalidated (no time filter)
How to set alerts (TradingView)
Click Create Alert.
Condition: choose this indicator, then pick one of the alert conditions above.
Select your alert options (once per bar close is recommended), then Create.
Tips
If you don’t see boxes, reduce Minimum FVG size or lower opacity (e.g., 70–85).
Body mode is stricter; start with wicks if you want more signals.
SB windows use Europe/Berlin and automatically account for DST.
The script respects platform limits for drawings; if your chart is cluttered, zoom in or reduce active sessions.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que la republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que la republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.