OPEN-SOURCE SCRIPT
已更新 Previous Day's Close Indicator (Regular Hours)

This indicator was developed to replace TradingView's built-in previous close indicator—which erroneously uses the close from two trading days prior. By capturing the actual last trade during the standard session, this script provides a reliable and precise previous close level.
Key features include:
Accurate Previous Close: This indicator locks in the last trade of the regular session, ensuring you always see the true previous day close.
Customizable Display Options: Users can choose between a line or circle plot, with adjustable size settings to suit their charting preferences.
Enjoy!
Key features include:
Accurate Previous Close: This indicator locks in the last trade of the regular session, ensuring you always see the true previous day close.
Customizable Display Options: Users can choose between a line or circle plot, with adjustable size settings to suit their charting preferences.
Enjoy!
發行說明
Previous Close Indicator – Updated VersionThis script plots the previous regular trading hours (RTH) close on the chart, providing traders with a key reference point for market analysis. The previous close is a widely used support/resistance level, often influencing price action in the following session.
🔹 How It Works:
Session Detection:
The script identifies whether the current time falls within regular trading hours (RTH): Monday to Friday from 09:30 to 16:00 (Eastern Time).
Tracking the Last RTH Close:
While inside RTH, the script continuously updates the last known close price.
When RTH ends, this final close price is stored as the previous close.
Plotting the Previous Close:
The script plots the stored value as a purple circle marker, ensuring clarity on the chart.
🔄 What’s New in This Update?
Optimized Logic: The script now efficiently tracks and stores the last RTH close, ensuring accuracy.
Simplified Code: The new version removes unnecessary conditions and variables, improving performance.
Trading Days Adjusted: Now correctly detects market sessions from Monday to Friday (day codes 2-6).
✅ How to Use It:
Important: Under Chart Settings, Symbol -> Session must be set to Extended Trading Hours for the indicator to work.
This indicator is ideal for traders who monitor gap behavior, overnight sentiment, or price reactions to the previous close.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。