OPEN-SOURCE SCRIPT
Aggiornato

Gann Session Box - 6:00 PM Open, Auto-Expanding

628
Gann Session Box — Auto-Expanding High/Low/50%

Marks the range of the current trading session as a live box that grows in real time. The box anchors at the session open (6:00 PM ET by default, the CME/COMEX electronic open), then stretches upward or downward the moment a new session high or low prints. The 50% line always sits at the midpoint of the current range and re-centers automatically as the box expands.

How the session anchor works

Rather than testing the clock hour on each bar, the script shifts every bar's timestamp back by the configured session offset and watches the calendar date flip in that shifted frame. This is date-based rather than hour-based, so it stays correct across DST changes, holiday sessions, data gaps, and chart types that would otherwise skip the exact opening bar.

Second-chart support

On sub-minute charts TradingView only loads a few hours of history, so a 6 PM anchor frequently falls outside the loaded data and the session would never be detected. The session high, low and midpoint are therefore computed on a higher calculation timeframe (1 minute by default) via request.security, which pulls its own history independently of the chart's bar count. The result is a correct session range on a 1-second chart. Leave the calculation timeframe at 1 minute for second-based charts; raise it if you're on a slower chart and want fewer resource units.

Internal divisions

Optional subdivisions of the range:

Quarters — 25% / 50% / 75%
Gann eighths — 1/8 through 7/8, giving the standard eighth-based retracement grid within the session range

Inputs

Session start hour, minute and timezone
Calculation timeframe
Division mode, colors for box fill/border, high, low, midpoint and division lines
Toggles for flat H/L/mid rays, price labels, and retaining previous sessions' boxes

Notes

Set the symbol's session to Extended/Electronic hours. With RTH-only data the 6 PM bars don't exist and the box will anchor to the first available bar of the day instead. The default 6:00 PM with America/New_York is the ETH open for CME and COMEX products; if you switch the timezone dropdown, adjust the hour to match.
Note di rilascio
Gann Session Box — Auto-Expanding High/Low/50%

Marks the range of the current trading session as a live box that grows in real time. The box anchors at the session open (6:00 PM ET by default, the CME/COMEX electronic open), then stretches upward or downward the moment a new session high or low prints. The 50% line always sits at the midpoint of the current range and re-centers automatically as the box expands.

How the session anchor works

Rather than testing the clock hour on each bar, the script shifts every bar's timestamp back by the configured session offset and watches the calendar date flip in that shifted frame. This is date-based rather than hour-based, so it stays correct across DST changes, holiday sessions, data gaps, and chart types that would otherwise skip the exact opening bar.

Second-chart support

On sub-minute charts TradingView only loads a few hours of history, so a 6 PM anchor frequently falls outside the loaded data and the session would never be detected. The session high, low and midpoint are therefore computed on a higher calculation timeframe (1 minute by default) via request.security, which pulls its own history independently of the chart's bar count. The result is a correct session range on a 1-second chart. Leave the calculation timeframe at 1 minute for second-based charts; raise it if you're on a slower chart and want fewer resource units.

Internal divisions

Optional subdivisions of the range:

Quarters — 25% / 50% / 75%
Gann eighths — 1/8 through 7/8, giving the standard eighth-based retracement grid within the session range

Inputs

Session start hour, minute and timezone
Calculation timeframe
Division mode, colors for box fill/border, high, low, midpoint and division lines
Toggles for flat H/L/mid rays, price labels, and retaining previous sessions' boxes

Notes

Set the symbol's session to Extended/Electronic hours. With RTH-only data the 6 PM bars don't exist and the box will anchor to the first available bar of the day instead. The default 6:00 PM with America/New_York is the ETH open for CME and COMEX products; if you switch the timezone dropdown, adjust the hour to match.
Note di rilascio
Chart Fix
Note di rilascio
Chart Update

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.