OPEN-SOURCE SCRIPT
已更新 Time Period Highlighter V2

This indicator highlights custom time periods on any intraday chart in TradingView, making it easier to visualize your preferred trading sessions.
You can define up to three separate time ranges per day, each with precise start and end times down to the minute (e.g., 08:30 - 12:15, 14:00 - 16:45, and 20:00 - 22:30). The indicator shades the background of your chart during these periods, helping you quickly identify when you're most active or when specific market conditions occur.
Key Features:
Set start and end times (hours and minutes) for up to three trading sessions.
Automatically highlights these periods across any intraday timeframe.
Uses 24-hour time format aligned with your TradingView chart timezone.
Perfect for day traders, scalpers, or anyone needing clear visual cues for their trading windows.
This tool is especially useful for reviewing trading strategies, backtesting, or ensuring you're focusing on high-probability market hours.
Tip: Double-check that your chart timezone matches your desired session times for accurate highlighting.
You can define up to three separate time ranges per day, each with precise start and end times down to the minute (e.g., 08:30 - 12:15, 14:00 - 16:45, and 20:00 - 22:30). The indicator shades the background of your chart during these periods, helping you quickly identify when you're most active or when specific market conditions occur.
Key Features:
Set start and end times (hours and minutes) for up to three trading sessions.
Automatically highlights these periods across any intraday timeframe.
Uses 24-hour time format aligned with your TradingView chart timezone.
Perfect for day traders, scalpers, or anyone needing clear visual cues for their trading windows.
This tool is especially useful for reviewing trading strategies, backtesting, or ensuring you're focusing on high-probability market hours.
Tip: Double-check that your chart timezone matches your desired session times for accurate highlighting.
版本注释
UPDATED:⚡️Time Period Highlighter V3 – DescriptionThis TradingView Pine Script highlights three major trading sessions on your chart using user-defined open and close times in local timezones:
✨ What it Does:
✅ Highlights New York, London, and Hong Kong trading sessions using distinct background colors.
✅ Lets you customize:
Session visibility (on/off)
Open/close time (hour + minute)
Session color
✅ Automatically adapts to your chart’s timeframe and applies accurate timezone conversions.
✅ Displays labels at the session start and end:
Open label placed at the low of the session's first candle.
Close label placed at the high of the session's last candle.
🔴 IMPORTANT NOTE:
⚠️ THIS SCRIPT DOES NOT WORK CORRECTLY ABOVE 30-MINUTE TIMEFRAME!
Session open/close labels may not appear due to resolution mismatches on higher timeframes.
版本注释
### ⚡️ **Time Period Highlighter V3 – Session Visualizer**
This TradingView indicator highlights the **New York**, **London**, and **Hong Kong** trading sessions with fully customizable **time, color, and labels**.
---
### ✨ **Features:**
* ✅ Highlights each session with a distinct background color
* ✅ Shows **Open** and **Close** labels (e.g. “NY Open”, “HK Close”)
* ✅ Timezone-adjusted using correct local times
* ✅ Great for **manual backtesting** and identifying session behavior
---
### ⚠️ **IMPORTANT USAGE NOTE**
> 🚫 **WORKS ONLY ON TIMEFRAMES BELOW 30 MINUTES**
> 🕒 If you use this script on ** 1h, 4h, etc.**, **labels may not appear** because session start/end may not match any candle.
---
### ✅ **WORKAROUND for Higher Timeframes**
To make it work above 30 minutes, use **round session start/end times**.
Example: Instead of `09:30 – 16:00`, use `10:00 – 16:00`.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。