OPEN-SOURCE SCRIPT
Cập nhật Macro Range Highlighter

This Pine Script indicator creates visual boxes that highlight specific time-based price ranges throughout the trading day, operating in New York Eastern Time. It offers two distinct modes: a standard hourly range mode and a classic ICT (Inner Circle Trader) Macro mode.
Two Operating Modes
Mode 1: Standard Hourly 50-09 Ranges (Default)
This mode identifies and highlights the price range during the final 10 minutes of each hour (xx:50) through the first 9 minutes of the next hour (xx:09).
Examples of captured ranges:
08:50 - 09:09
09:50 - 10:09
10:50 - 11:09
11:50 - 12:09
12:50 - 13:09
13:50 - 14:09
14:50 - 15:09
And continues for each hour...
Excluded Time Periods:
The indicator excludes certain periods that cross into or occur during market close and the daily reset:
02:50 - 03:09 (excluded to avoid interference with overnight session)
15:50 - 18:09 (excluded to avoid end-of-regular-hours and the 18:00 ET trading day reset)
This means you will NOT see boxes during the 16:00 or 17:00 hours, as these fall within the excluded window.
Mode 2: Classic ICT Macro Times
When enabled, this mode shows ONLY four specific time windows that are significant in ICT methodology:
02:33 - 02:59 (London Midnight Macro)
04:03 - 04:29 (London Open Macro)
13:10 - 13:39 (New York Lunch Macro)
15:15 - 15:44 (New York Close Macro)
When this mode is active, all standard hourly ranges are disabled, including the 02:50-03:09 range.
Green Line - Open Price
Represents the open price of the first candle when the range begins
This line is static once set - it shows where price opened when entering the time window
Extends horizontally across the entire duration of the box
Example: If the range starts at 08:50 and that candle opens at 18,500, the green line will be drawn at 18,500
Blue Line - Evolving Midpoint
Represents the dynamic midpoint between the range high and range low
This line continuously recalculates as new highs or lows are made within the time window
Calculation: Midpoint = (Range High + Range Low) / 2
Evolution example:
At 08:50, range is 18,480 (low) to 18,520 (high), midpoint = 18,500
At 08:55, price makes new high of 18,540, midpoint updates to 18,510
At 09:02, price makes new low of 18,470, midpoint updates to 18,505
The line visually adjusts up and down as the range expands
Extension: The line extends horizontally from the start of the range to the current bar (or end of range)
This gives traders a visual reference for the "fair value" or equilibrium point of the range
Red Line - Close Price
Represents the close price of the most recent candle within the time window
This line updates continuously with each new bar's close price
Extends horizontally across the range
When the range completes (exits the time window), it shows the final close price of the last bar in the range
Example: As price moves from 08:50 to 09:09, the red line will track the close of each candle: 18,505 → 18,510 → 18,508 → 18,515, etc.
This indicator provides a sophisticated visual framework for analyzing specific time-based price behavior. The evolving midpoint (blue line and optional yellow plot) is particularly powerful because it gives you real-time feedback on where the "fair value" of the range is as it develops, allowing you to make informed decisions about whether price is extended or returning to equilibrium. The three-line system (open/mid/close) creates a complete picture of price action within each critical time window, whether you're using standard hourly analysis or focusing on ICT's specific macro times.
Two Operating Modes
Mode 1: Standard Hourly 50-09 Ranges (Default)
This mode identifies and highlights the price range during the final 10 minutes of each hour (xx:50) through the first 9 minutes of the next hour (xx:09).
Examples of captured ranges:
08:50 - 09:09
09:50 - 10:09
10:50 - 11:09
11:50 - 12:09
12:50 - 13:09
13:50 - 14:09
14:50 - 15:09
And continues for each hour...
Excluded Time Periods:
The indicator excludes certain periods that cross into or occur during market close and the daily reset:
02:50 - 03:09 (excluded to avoid interference with overnight session)
15:50 - 18:09 (excluded to avoid end-of-regular-hours and the 18:00 ET trading day reset)
This means you will NOT see boxes during the 16:00 or 17:00 hours, as these fall within the excluded window.
Mode 2: Classic ICT Macro Times
When enabled, this mode shows ONLY four specific time windows that are significant in ICT methodology:
02:33 - 02:59 (London Midnight Macro)
04:03 - 04:29 (London Open Macro)
13:10 - 13:39 (New York Lunch Macro)
15:15 - 15:44 (New York Close Macro)
When this mode is active, all standard hourly ranges are disabled, including the 02:50-03:09 range.
Green Line - Open Price
Represents the open price of the first candle when the range begins
This line is static once set - it shows where price opened when entering the time window
Extends horizontally across the entire duration of the box
Example: If the range starts at 08:50 and that candle opens at 18,500, the green line will be drawn at 18,500
Blue Line - Evolving Midpoint
Represents the dynamic midpoint between the range high and range low
This line continuously recalculates as new highs or lows are made within the time window
Calculation: Midpoint = (Range High + Range Low) / 2
Evolution example:
At 08:50, range is 18,480 (low) to 18,520 (high), midpoint = 18,500
At 08:55, price makes new high of 18,540, midpoint updates to 18,510
At 09:02, price makes new low of 18,470, midpoint updates to 18,505
The line visually adjusts up and down as the range expands
Extension: The line extends horizontally from the start of the range to the current bar (or end of range)
This gives traders a visual reference for the "fair value" or equilibrium point of the range
Red Line - Close Price
Represents the close price of the most recent candle within the time window
This line updates continuously with each new bar's close price
Extends horizontally across the range
When the range completes (exits the time window), it shows the final close price of the last bar in the range
Example: As price moves from 08:50 to 09:09, the red line will track the close of each candle: 18,505 → 18,510 → 18,508 → 18,515, etc.
This indicator provides a sophisticated visual framework for analyzing specific time-based price behavior. The evolving midpoint (blue line and optional yellow plot) is particularly powerful because it gives you real-time feedback on where the "fair value" of the range is as it develops, allowing you to make informed decisions about whether price is extended or returning to equilibrium. The three-line system (open/mid/close) creates a complete picture of price action within each critical time window, whether you're using standard hourly analysis or focusing on ICT's specific macro times.
Phát hành các Ghi chú
Bug FixMã 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.