OPEN-SOURCE SCRIPT
FVG (Nephew sam remake)

Hello i am making my own FVG script inspired by Nephew Sam as his fvg code is not open source. My goal is to replicate his Script and then add in alerts and more functions. Thus, i spent few days trying to code. There is bugs such as lower time frame not showing higher time frame FVG.
This script automatically detects and visualizes Fair Value Gaps (FVGs) — imbalances between demand and supply — across multiple timeframes (15-minute, 1-hour, and 4-hour).
15m chart shows:
15m FVGs (green/red boxes)
1H FVGs (lime/maroon)
4H FVGs (faded green/red with borders) (Bugged For now i only see 1H appearing)
1H chart shows:
1H FVGs
4H FVGs
4H chart shows:
4H FVGs only
There is the function to auto close FVG when a future candle fully disrespected it.
You're welcome to:
🔧 Customize the appearance: adjust box colors, transparency, border style
🧪 Add alerts: e.g., when price enters or fills a gap
📅 Expand to Daily/Weekly: just copy the logic and plug in "D" or "W" as new layers
📈 Build confluence logic: combine this with order blocks, liquidity zones, or ICT concepts
🧠 Experiment with entry signals: e.g., candle confirmation on return to FVG
🚀 Improve performance: if you find a lighter way to track gaps, feel free to optimize!
This script automatically detects and visualizes Fair Value Gaps (FVGs) — imbalances between demand and supply — across multiple timeframes (15-minute, 1-hour, and 4-hour).
15m chart shows:
15m FVGs (green/red boxes)
1H FVGs (lime/maroon)
4H FVGs (faded green/red with borders) (Bugged For now i only see 1H appearing)
1H chart shows:
1H FVGs
4H FVGs
4H chart shows:
4H FVGs only
There is the function to auto close FVG when a future candle fully disrespected it.
You're welcome to:
🔧 Customize the appearance: adjust box colors, transparency, border style
🧪 Add alerts: e.g., when price enters or fills a gap
📅 Expand to Daily/Weekly: just copy the logic and plug in "D" or "W" as new layers
📈 Build confluence logic: combine this with order blocks, liquidity zones, or ICT concepts
🧠 Experiment with entry signals: e.g., candle confirmation on return to FVG
🚀 Improve performance: if you find a lighter way to track gaps, feel free to optimize!
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.