OPEN-SOURCE SCRIPT
ICT Silver Bullet & 2022 Entry Model

This script is a fully automated algorithmic scanner and trade visualizer for the ICT 2022 Mentorship Entry Model, specifically programmed to only look for setups during the Silver Bullet time windows.
Here is a breakdown of how the engine works from top to bottom:
1. Time & Sessions Engine
The script begins by shading your chart background for the three specific "Silver Bullet" execution hours (EST):
London: 03:00 - 04:00 (Silver)
New York AM: 10:00 - 11:00 (Orange)
New York PM: 14:00 - 15:00 (Teal) The script will strictly ignore any price action outside of these three windows.
2. The 5-Phase State Machine
Inside those sessions, the script runs a rigid 5-step sequence to validate the 2022 Model. It will cancel the setup if the sequence is broken.
Phase 1: Liquidity Raid (The Stop Run) The script tracks historical Swing Highs (Buy-Side Liquidity) and Swing Lows (Sell-Side Liquidity). If price sweeps one of these levels, it prints a "BSL Raid" or "SSL Raid" label. Crucially, it nullifies that specific liquidity level immediately after it's swept so you don't get duplicate labels on every single candle.
Phase 2: Market Structure Shift (ChoCh) Upon sweeping liquidity, the script identifies the exact minor swing point that formed just prior to the sweep. It waits for price to aggressively reverse and close past that level. When it does, it plots a line and a "ChoCh" (Change of Character / MSS) label.
Phase 3: Displacement FVG Detection The leg that breaks structure must show institutional displacement. The script scans the exact 3-5 candles that broke the ChoCh level to find a Fair Value Gap (SIBI for shorts, BISI for longs). If it finds one, it draws the gap box on your chart.
Phase 4: Trade Execution The script waits for price to retrace and tap the open boundary of the FVG. The moment price touches it, the script prints a "2022 SHORT ENTRY" or "2022 LONG ENTRY" label.
Phase 5: Trade Management & Visualizer (The code block you highlighted) Upon entry, the script transitions into a live trade manager:
Stop Loss (SL): It calculates an SL exactly 1 tick above the absolute peak of the Liquidity Raid. It draws a solid red line and a red risk box.
Take Profit (TP): By default, it targets the opposing major liquidity pool on the chart. If you toggle it off in settings, it defaults to a strict 1:2 Risk-to-Reward ratio. It draws a solid green line and a green reward box.
Live Tracking: The script physically extends these red and green boxes forward bar-by-bar until price hits either the SL line or the TP line. Once hit, it closes the trade, prints "SL HIT" or "TP HIT", and resets the engine to look for the next setup.
Here is a breakdown of how the engine works from top to bottom:
1. Time & Sessions Engine
The script begins by shading your chart background for the three specific "Silver Bullet" execution hours (EST):
London: 03:00 - 04:00 (Silver)
New York AM: 10:00 - 11:00 (Orange)
New York PM: 14:00 - 15:00 (Teal) The script will strictly ignore any price action outside of these three windows.
2. The 5-Phase State Machine
Inside those sessions, the script runs a rigid 5-step sequence to validate the 2022 Model. It will cancel the setup if the sequence is broken.
Phase 1: Liquidity Raid (The Stop Run) The script tracks historical Swing Highs (Buy-Side Liquidity) and Swing Lows (Sell-Side Liquidity). If price sweeps one of these levels, it prints a "BSL Raid" or "SSL Raid" label. Crucially, it nullifies that specific liquidity level immediately after it's swept so you don't get duplicate labels on every single candle.
Phase 2: Market Structure Shift (ChoCh) Upon sweeping liquidity, the script identifies the exact minor swing point that formed just prior to the sweep. It waits for price to aggressively reverse and close past that level. When it does, it plots a line and a "ChoCh" (Change of Character / MSS) label.
Phase 3: Displacement FVG Detection The leg that breaks structure must show institutional displacement. The script scans the exact 3-5 candles that broke the ChoCh level to find a Fair Value Gap (SIBI for shorts, BISI for longs). If it finds one, it draws the gap box on your chart.
Phase 4: Trade Execution The script waits for price to retrace and tap the open boundary of the FVG. The moment price touches it, the script prints a "2022 SHORT ENTRY" or "2022 LONG ENTRY" label.
Phase 5: Trade Management & Visualizer (The code block you highlighted) Upon entry, the script transitions into a live trade manager:
Stop Loss (SL): It calculates an SL exactly 1 tick above the absolute peak of the Liquidity Raid. It draws a solid red line and a red risk box.
Take Profit (TP): By default, it targets the opposing major liquidity pool on the chart. If you toggle it off in settings, it defaults to a strict 1:2 Risk-to-Reward ratio. It draws a solid green line and a green reward box.
Live Tracking: The script physically extends these red and green boxes forward bar-by-bar until price hits either the SL line or the TP line. Once hit, it closes the trade, prints "SL HIT" or "TP HIT", and resets the engine to look for the next setup.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.