OPEN-SOURCE SCRIPT
ที่อัปเดต: 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.
Release Note
// 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.
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน