Intraday Background Time Ranges

The experience shows that every financial instrument has its own personality. With this in mind, the script can be useful to study intraday charts with the purpose of discovering recurring behaviours of specific instruments over a certain time range and under specific circumstances (normal days, earnings days, days with catalysts, etc.) This can help the trader to deeply understand the instrument personality, and therefore also to decide whether to enter or exit the market if its behaviour meets or not his expectations.
Please note that this script only works on minute/hourly charts.
Cleaned the code.
1) Shortened the short title, which now is "Time Ranges".
2) Removed the seconds time frame limitation.
3) Cleaned, simplified and improved the overall appearance of the code.
Added 17 additional time ranges, bringing the total to 30.
This new version includes the option to choose whether to project the colors ahead of time, allowing you to see them even before the price reaches the specified time.
In order to achieve this purpose, I had to modify the input mode for the time ranges.
- Fixed the code that displayed the table frame when the time range was selected even in the absence of text.
- Converted the code to v6.
- Added a new option that lets you choose how the indicator handles time zones:
· Exchange: Time ranges follow the time zone of the current symbol.
· Custom: Select a fixed time zone from a dropdown list to apply across any chart.
Let me know if your time zone is missing, so it can be added in the next update or once at least three requests are collected.
NOTE: If the chart is set to a time zone different from the exchange's, make sure time ranges start after the market opens in the chart’s time zone. Otherwise, they won’t be displayed.
- Time ranges can now be shown on selected weekdays only. The table updates accordingly.
- Improved the way time ranges are shown in advance, eliminating visual flickering.
- Refined the menu layout and made time range inputs more user-friendly.
- Cleaned up the code.
If the chart is set to a time zone different from the exchange's, make sure time ranges end after the market opens in the chart's time zone. Ranges that start before the open will be partially visible if they end after the open.
Explanation:
For example, if the indicator is set with a custom time zone like "Australia/Sydney" on a US stock chart with extended hours enabled, 4 a.m. EST (the start of pre-market) corresponds to 6:00 p.m. in Sydney. Therefore, you need to set a range that starts at 18:00, or at least ends at 18:01 — in the latter case, only one minute of background will be colored.
Fixed the "Anticipate" parameter not working as expected.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Để truy cập nhanh vào biểu đồ, hãy thêm tập lệnh này vào mục yêu thích của bạn — tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Để truy cập nhanh vào biểu đồ, hãy thêm tập lệnh này vào mục yêu thích của bạn — tìm hiểu thêm tại đây.