OPEN-SOURCE SCRIPT
Cập nhật YH / YL / YC (Live) - Improved

This is an enhanced version of the original **“YH / YL / YC (Live)”** script by **Ilse Filippo** (`Ilse_Filippo` on TradingView).
The indicator automatically plots the previous completed trading session’s:
* **YH** — Yesterday High
* **YL** — Yesterday Low
* **YC** — Yesterday Close
It supports stocks, ADRs, ETFs, indices, futures, forex, and metals.
### Improvements in v1.2
* Migrated to **Pine Script v6**
* Added weekend-aware handling so **Friday’s YH / YL / YC are already available on Saturday and Sunday**
* Friday remains the reference while Monday’s session is still active
* Replaced the original manual stock RTH tracking with TradingView’s native **regular-session data**
* Fixed missing **YH / YL** levels on stock charts
* Stocks, ADRs, and ETFs now use their exchange-defined regular trading session
* Preserved the original line and label presentation
### Credits
Original script: **YH / YL / YC (Live)**
Original author: **Ilse Filippo**
TradingView: **Ilse_Filippo**
This modified version retains the open-source distribution model of the original script.
The indicator automatically plots the previous completed trading session’s:
* **YH** — Yesterday High
* **YL** — Yesterday Low
* **YC** — Yesterday Close
It supports stocks, ADRs, ETFs, indices, futures, forex, and metals.
### Improvements in v1.2
* Migrated to **Pine Script v6**
* Added weekend-aware handling so **Friday’s YH / YL / YC are already available on Saturday and Sunday**
* Friday remains the reference while Monday’s session is still active
* Replaced the original manual stock RTH tracking with TradingView’s native **regular-session data**
* Fixed missing **YH / YL** levels on stock charts
* Stocks, ADRs, and ETFs now use their exchange-defined regular trading session
* Preserved the original line and label presentation
### Credits
Original script: **YH / YL / YC (Live)**
Original author: **Ilse Filippo**
TradingView: **Ilse_Filippo**
This modified version retains the open-source distribution model of the original script.
Phát hành các Ghi chú
// REVISION HISTORY// v1.1 - 2026-08-23
// - Migrated to Pine Script v6.
// - Added completed-daily-bar detection for weekend handling.
// - Preserved the original stock RTH handling and drawing logic.
//
// v1.2 - 2026-09-26
// - Corrected the weekend/closed-session daily-source logic for indices/futures.
// - Current daily OHLC is requested with lookahead_on, while time_close/timenow
// explicitly gates whether the current daily bar is allowed to become YH/YL/YC.
// - During an active daily session, YH/YL/YC still use the previous completed day.
// - After the daily session closes, the just-completed day becomes the reference,
// so Friday remains visible on Saturday/Sunday and into Monday before Monday closes.
// - Updated default YH/YL/YC colors to the user's current chart defaults.
// - No changes to stock RTH tracking, line placement, or label placement.
//
// v1.3 - 2026-09-26
// - Added optional price display to YH / YL / YC labels.
// - Added "Show Price in Labels" configuration option.
// - Label format uses one space between level name and price.
// - Prices below 10,000 are displayed with maximum 1 decimal.
// - Prices at or above 10,000 are rounded to integer.
// - Increased default label offset from 15 to 45 bars.
// - No changes to YH/YL/YC source logic, weekend handling, or line placement.
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.
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.