Previous Day's Close Indicator (Regular Hours)

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!
This 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.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.
Penafian
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.