OPEN-SOURCE SCRIPT
Silver Bullet & First/Last FVG

It is designed around the popular ICT (Inner Circle Trader) "Silver Bullet" concepts. Its main purpose is to highlight specific time-based trading windows on your chart and automatically detect and isolate the most significant Fair Value Gaps (FVGs) that form within those windows.
Here is a breakdown of its functionality:
1. Specific Time Sessions
The script monitors three specific 1-hour time windows (defaulting to New York time, but adjustable):
London Silver Bullet: 03:00 - 04:00
New York AM Silver Bullet: 10:00 - 11:00
New York PM Silver Bullet: 14:00 - 15:00
Each of these sessions can be toggled on/off individually, and their border colors customized.
2. Session Range Highlighting
When one of these 1-hour sessions begins, the script starts tracking the absolute Highest and Lowest price reached during that hour.
Once the session ends, it draws a large, semi-transparent box encapsulating that entire 1-hour price action range.
The box is labeled in the bottom right corner (e.g., "Lon SB" or "NY AM SB") so you can easily visually identify the Silver Bullet hour in hindsight.
3. First and Last FVG Detection
This is the most unique feature of the script. While standard indicators highlight every FVG, this script filters them based on the Silver Bullet sessions:
It continuously looks for standard 3-candle Fair Value Gaps (both bullish and bearish).
However, it only plots FVGs if they occur inside one of the active Silver Bullet sessions.
Furthermore, to reduce clutter, it only stores and plots the First FVG and the Last FVG that formed during that specific 1-hour window.
It automatically extends the boxes of these specific FVGs to match the right edge (end time) of the Silver Bullet session box.
4. Memory and Optimization
To prevent TradingView from throwing "too many drawings" errors or causing lag on your chart:
It uses a custom data structure (SBSessionData) to manage the state of each session cleanly.
At the start of every new day, it runs a cleanup function (clearDrawings()) that deletes older session boxes and FVGs if they exceed the user-defined sb_lookback limit (default 100 historical boxes).
Here is a breakdown of its functionality:
1. Specific Time Sessions
The script monitors three specific 1-hour time windows (defaulting to New York time, but adjustable):
London Silver Bullet: 03:00 - 04:00
New York AM Silver Bullet: 10:00 - 11:00
New York PM Silver Bullet: 14:00 - 15:00
Each of these sessions can be toggled on/off individually, and their border colors customized.
2. Session Range Highlighting
When one of these 1-hour sessions begins, the script starts tracking the absolute Highest and Lowest price reached during that hour.
Once the session ends, it draws a large, semi-transparent box encapsulating that entire 1-hour price action range.
The box is labeled in the bottom right corner (e.g., "Lon SB" or "NY AM SB") so you can easily visually identify the Silver Bullet hour in hindsight.
3. First and Last FVG Detection
This is the most unique feature of the script. While standard indicators highlight every FVG, this script filters them based on the Silver Bullet sessions:
It continuously looks for standard 3-candle Fair Value Gaps (both bullish and bearish).
However, it only plots FVGs if they occur inside one of the active Silver Bullet sessions.
Furthermore, to reduce clutter, it only stores and plots the First FVG and the Last FVG that formed during that specific 1-hour window.
It automatically extends the boxes of these specific FVGs to match the right edge (end time) of the Silver Bullet session box.
4. Memory and Optimization
To prevent TradingView from throwing "too many drawings" errors or causing lag on your chart:
It uses a custom data structure (SBSessionData) to manage the state of each session cleanly.
At the start of every new day, it runs a cleanup function (clearDrawings()) that deletes older session boxes and FVGs if they exceed the user-defined sb_lookback limit (default 100 historical boxes).
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.