OPEN-SOURCE SCRIPT
Обновлено Initial 1-Hour High/Low Range Box & Breakout Extension v6

### Description
This script automatically identifies the high and low range of the **initial 1 hour** of the trading session and plots a dynamic bounding box that extends throughout the rest of the day.
### Key Features
- **Initial 1-Hour Range Box**: Captures the exact highest and lowest price points within the first 60 minutes.
- **Dynamic Mid-lines**: Automatically plots a median/mid-line inside both the initial range and breakout boxes.
- **2nd Floor Breakout Expansion**: If the price breaks above the 1-hour high after the initial hour (based on bar close), it clones a secondary box with the exact same vertical height stacked directly on top of the initial high.
- **Highly Customizable**: Easily adjust colors, borders, line thickness, dashed/dotted styles, and session reset times from the settings panel.
### Notes
Optimized for **Intraday charts (e.g., 5-min, 15-min)**. Default time settings are pre-configured for **UTC-7 (06:30 - 13:00 trading hours)** but can be fully customized for any specific market session or asset class (Stocks, Crypto, and Futures like MNQ/NQ).
This script automatically identifies the high and low range of the **initial 1 hour** of the trading session and plots a dynamic bounding box that extends throughout the rest of the day.
### Key Features
- **Initial 1-Hour Range Box**: Captures the exact highest and lowest price points within the first 60 minutes.
- **Dynamic Mid-lines**: Automatically plots a median/mid-line inside both the initial range and breakout boxes.
- **2nd Floor Breakout Expansion**: If the price breaks above the 1-hour high after the initial hour (based on bar close), it clones a secondary box with the exact same vertical height stacked directly on top of the initial high.
- **Highly Customizable**: Easily adjust colors, borders, line thickness, dashed/dotted styles, and session reset times from the settings panel.
### Notes
Optimized for **Intraday charts (e.g., 5-min, 15-min)**. Default time settings are pre-configured for **UTC-7 (06:30 - 13:00 trading hours)** but can be fully customized for any specific market session or asset class (Stocks, Crypto, and Futures like MNQ/NQ).
Информация о релизе
### DescriptionThis script is fully optimized for **Pine Script v6** and introduces precise intraday session boundary control. It automatically identifies the highest and lowest price points during the **initial 1 hour** of the specified session and projects a dynamic bounding box and mid-line that extends **only during the active trading hours**.
### What's New in this Update (v6 & Session Restrict)
- **Strict Session Bounding**: Boxes and mid-lines are drawn and extended **exclusively during the defined session hours** (e.g., 06:30 - 13:00 GMT-7). Once the session ends, drawings immediately stop extending, keeping your chart completely clean during overnight/extended hours (Globex).
- **Pine Script v6 Migration**: Rebuilt entirely from the ground up using the latest v6 standards with explicit type styling and fully compliant `GMT` timezone formatting to prevent any compiler warnings or runtime errors.
### Key Features
- **Initial 1-Hour Range Box**: Captures the exact high/low range within the first 60 minutes of the session.
- **Dynamic Mid-lines**: Automatically plots a median/mid-line inside both the initial range and breakout boxes.
- **2nd Floor Breakout Expansion**: If the price breaks above the 1-hour high after the initial hour (based on bar close), it clones a secondary box with the exact same vertical height stacked directly on top of the initial high.
- **Highly Customizable Settings**: Easily adjust start/end times, border/background colors, line thickness, and styles (Solid, Dotted, Dashed) from the inputs panel.
### Settings Note
Default inputs are pre-configured for **GMT-7 (06:30 - 13:00 intraday hours)**, making it highly effective for trading continuous futures like MNQ/NQ during major market hours, as well as regular stocks. Make sure to use it on intraday charts like 1-min, 5-min, or 15-min.
Информация о релизе
# Initial High/Low Range Box & Breakout Extension (v6)Pine Script overlay that locks an opening **high/low range**, then draws equal-height **breakout floors** when price expands above that range.
## What’s new
### 1. Configurable initial range duration
Previously the script always used a **fixed 60-minute** window to lock the 1st-floor high/low.
You can now set this in **Inputs → Initial Range Minutes**:
| Value | Behavior |
|------:|----------|
| `30` | Locks high/low after the first 30 minutes of the session (default) |
| `60` | Same as the old “1-hour” behavior |
| Other | Any duration from 1–240 minutes |
After that window ends, the 1st-floor box height is frozen and used for later floors.
### 2. 3rd floor breakout extension
When price breaks the **2nd floor top**, the script draws a **3rd floor** box of the same height, with its own mid-line and colors.
Floor logic (upside only):
1. **1st floor** — session start → lock initial high/low for *N* minutes
2. **2nd floor** — `close >` 1st-floor high → box from high → high + height
3. **3rd floor** — `close >` 2nd-floor top → box from 2nd top → 2nd top + height
## Quick setup
1. Add the indicator to an intraday chart.
2. Set session start/end (defaults: **06:30–13:00 GMT-7**).
3. Set **Initial Range Minutes** to `30` or `60`.
4. Optionally restyle 1st / 2nd / 3rd floor colors.
## Inputs (summary)
| Input | Purpose |
|-------|---------|
| Session Start/End Hour & Minute | Trading window (GMT-7) |
| **Initial Range Minutes** | Minutes to build/lock 1st-floor high/low |
| Initial / Breakout / 3rd Floor colors | Box borders, fills, mid-lines |
| Mid-line Width / Style | Shared mid-line look |
## Notes
- Requires an **intraday** timeframe.
- Boxes and mid-lines extend through the active session only.
- Upside breakouts only (same as the original 2nd-floor logic).
- Session clock uses **GMT-7**.
Информация о релизе
# Initial High/Low Range Box & Breakout Extension (v6)Pine Script overlay that locks an opening **high/low range** (1st floor), then draws equal-height **breakout floors** (2nd–4th) when price expands above that range.
Timezone for the session window: **GMT-7**.
---
## Features
### Initial range (1st floor)
- Builds high/low from session start for a configurable number of minutes.
- Draws a range box + mid-line through the session.
- After the window ends, height is frozen and reused for upper floors.
### Breakout floors (2nd / 3rd / 4th)
Upside-only, same height as the locked 1st-floor box:
| Floor | Trigger | Box span |
|------:|---------|----------|
| 2nd | `close >` 1st-floor high | high → high + 1× height |
| 3rd | `close >` 2nd-floor top | 2nd top → 2nd top + 1× height |
| 4th | `close >` 3rd-floor top | 3rd top → 3rd top + 1× height |
Each floor has its own border, fill, and mid-line colors.
### Configurable range duration
**Initial Range Minutes** (default `60`):
- `60` — classic 1-hour behavior
- `30` — lock after first 30 minutes
- Other values allowed from `1`–`240`
### Edge padding (time-anchored)
Boxes/lines use `xloc.bar_time` so they stay stuck to the chart timeline (not floating `bar_index` offsets).
| Input | Purpose |
|-------|---------|
| **1st Floor Left Padding (bars)** | Moves 1st-floor left edge N bars **before** the first session candle |
| **Breakout Floors Left Padding (bars)** | Left gap for 2nd/3rd/4th floor start edges |
| **Box Right Padding (bars)** | Right gap past the active candle |
Padding is based on the chart timeframe duration so edges stay aligned with the graph.
---
## Quick setup
1. Add the indicator to an **intraday** chart.
2. Set session start/end (defaults: **06:30–13:00 GMT-7**).
3. Set **Initial Range Minutes** (`30` or `60`).
4. Tune left/right padding if vertical edges sit on candles.
5. Optionally restyle floor colors / mid-line style.
---
## Inputs
### Session
| Input | Default | Description |
|-------|--------:|-------------|
| Session Start Hour / Minute | 6 / 30 | Session open (GMT-7) |
| Session End Hour / Minute | 13 / 0 | Session close (GMT-7) |
| Initial Range Minutes | 30 | Minutes to build/lock 1st-floor high/low |
### Padding
| Input | Default | Description |
|-------|--------:|-------------|
| 1st Floor Left Padding (bars) | 2 | Clears 1st-floor left edge from the open candle |
| Breakout Floors Left Padding (bars) | 2 | Left padding for floors 2–4 |
| Box Right Padding (bars) | 2 | Right padding for all active floors |
### Styles
| Group | Controls |
|-------|----------|
| 1st floor | Border, background, mid-line color/width/style |
| 2nd floor | Border, background, mid-line color |
| 3rd floor | Border, background, mid-line color |
| 4th floor | Border, background, mid-line color |
---
## Behavior notes
- Requires an **intraday** timeframe.
- Drawings extend only while the bar is **inside the session**.
- Upside breakouts only (no downside floors).
- Mid-line style options: Solid / Dotted / Dashed.
- If a left edge still looks tight on the open candle, increase **1st Floor Left Padding** to `3`–`5`.
- Set all paddings to `0` for edges clamped tightly to bar times.
---
## Changelog
### Current
- Configurable initial range duration (default 30 minutes).
- Added 3rd and 4th floor breakout boxes.
- Left/right edge padding with time-based anchoring.
- Dedicated **1st Floor Left Padding** so the open candle is not covered by the left vertical.
### Earlier
- Original 1st-floor range box + mid-line.
- 2nd-floor upside breakout extension (fixed 60-minute range).
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.