PROTECTED SOURCE SCRIPT
已更新

Opening Range Breakouts

326
Opening Range Breakouts (ORB) Indicator

This is a powerful trading range breakout indicator, specifically designed to capture breakout opportunities across different trading sessions.

Key Features
1. Multi-session Monitoring
• Opening Range (default 06:00–06:30)
• Asian Session Range (default 08:00–08:30)
• European Session Range (default 15:30–16:00)
• U.S. Session Range (default 21:30–22:00)
2. Range Display
• High, Low, and Midpoint lines for each session
• Range boxes with different fill colors
• Fully customizable colors and transparency for each session
• Option to show/hide historical data
3. Breakout Targets
• Set target levels as a percentage of the range
• Supports Adaptive or Extension display modes
• Customizable target line styles and colors
• Choose between Close Price or High/Low as trigger conditions
4. Smart Gap Handling
• Option to ignore price gaps
• Smart calculation of ranges in gap scenarios
5. Flexible Time Zone Settings
• Supports all major global time zones
• Ensures accurate display across different markets

Usage Tips
1. Select appropriate timeframes based on the instrument traded; sub-daily timeframes are recommended.
2. Enable/disable trading sessions according to your trading style.
3. Adjust target percentages to fit the volatility profile of different instruments.
4. Combine with other technical indicators to validate breakout signals.

Notes
1. Timeframe must be lower than Daily.
2. It is recommended to combine with volume or other indicators in live trading.
3. Session times may need to be adjusted for different markets.
4. Target line settings should reflect actual market volatility.

This indicator is particularly suitable for intraday traders who want to capture breakout opportunities during key trading sessions. It visualizes the price ranges of major sessions, helping traders better seize market opportunities.
版本注释
Fix opening range candlestick calculation issue
版本注释




**Overview**
- Adds automatic Daylight Saving Time handling aligned with US rules.
- Fixes a 5-hour lag caused by timezone-dependent string formatting.

**Key Changes**
- New input `autoDST`: when enabled, US DST dates are applied automatically.
- Session ranges now use adjusted strings: `openSeshAdj`, `euSeshAdj`, `usSeshAdj`.
- Asia session stays unchanged by DST, matching the original MT4 `ORB.mq4` logic.
- Replaced `timestamp`-based time formatting with pure zero-padded numbers to avoid chart-timezone side effects.

**How It Works**
- US DST window: from the second Sunday in March to the first Sunday in November.
- During DST: `openSesh`, `euSesh`, `usSesh` run exactly as configured.
- During winter (non-DST): `openSesh`, `euSesh`, `usSesh` hours are automatically shifted +1 hour; minutes are preserved and hours wrap within 0–23.
- Asia session (`asiaSesh`) is not adjusted in winter.
- Session detection uses `time(timeframe.period, <AdjustedRange>, tz)` and respects your selected `tz`.

**Bug Fix**
- Previously, session strings were built using `timestamp` + `str.format("{0,date,HHmm}")`, which formatted times in the chart’s timezone and could appear 5 hours late.
- Now, times are formatted with `str.format("{0,number,00}{1,number,00}")`, which is timezone-independent, eliminating the 5-hour lag.

**Inputs**
- `autoDST`: toggles automatic US DST/winter conversion for Open/EU/US sessions.
- `tz`: unchanged; choose the timezone used for session evaluation (e.g., `UTC+8`).

**Examples**
- Example 1: `usSesh = "2130-2200"` in `UTC+8`
- US DST period: runs at "2130-2200".
- Winter period: automatically runs at "2230-2300".
- Example 2: `euSesh = "1530-1600"`
- US DST period: "1530-1600".
- Winter period: "1630-1700".
- Example 3: `asiaSesh = "0800-0830"`
- Always "0800-0830" (no DST adjustment).

**Notes**
- DST boundaries are date-based (full-day), not the exact 02:00 switch hour; this mirrors the practical approach in `ORB.mq4`.
- Chart timezone does not influence session string generation; `tz` input does.
- If you need Europe-specific DST rules or per-market DST toggles, I can add separate switches.

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。