Previous Close Indicator – Updated Version
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.