INVITE-ONLY SCRIPT

3CRGANG - SESSIONS

61
Overview
The "3CRGANG - SESSIONS" indicator is a comprehensive tool for visualizing and monitoring major global trading sessions on TradingView charts. It highlights sessions for key exchanges—New York (NYSE), London (LSE), Frankfurt (FSE), Sydney (ASX), Tokyo (TSE), and Hong Kong (HKSE)—with customizable alerts, background coloring on low timeframes, and an interactive dashboard table. Designed for traders who operate across timezones or need session-based context, it accounts for holidays, half-days, and daylight saving time (DST) adjustments to provide accurate, real-time session status. On charts of 1-minute or lower, it overlays semi-transparent background colors to mark active sessions visually. Across all timeframes, a compact table at the bottom center displays session cells with dynamic coloring, and hovering over each reveals a tooltip with the weekly schedule, time until open/close, and holiday notes.

Built on Pine Script v6, this overlay indicator enhances situational awareness for forex, stocks, futures, and other assets by syncing with exchange-specific calendars. Its invite-only status ensures access to refined features that go beyond standard session tools, making it ideal for multi-market strategies.



How It's Built: Core Concepts and Calculations
The indicator leverages a modular approach to session detection, drawing from time-based logic for precision. Sessions are defined by fixed start/end times in their native timezones (e.g., NYSE: 0930-1600 America/New_York), adjusted dynamically for DST via timezone-aware functions. Key components include:

  • Session Activation Checks: Using helper functions like f_isSessionActive, it evaluates if the current bar or real-time timestamp falls within session hours, excluding weekends. Time is broken into minutes since midnight for comparisons, with special handling for overnight sessions (though none here cross midnight significantly).

  • Holiday and Half-Day Integration: Pre-loaded holiday maps for each exchange detect full closures or early closes (e.g., NYSE half-days end at custom times like 1300). If a half-day is identified, session end times are overridden, and pre-close periods recalculated (e.g., 30/5 minutes before adjusted close).

  • Pre-Open/Pre-Close Detection: Sub-sessions (e.g., 30 minutes before open) use similar logic to flag impending events, triggering only on the first bar of these windows via f_SessionOpen and f_SessionClose for efficiency.

  • Timestamp Calculations: Functions like f_SessionTimes and f_SessionTimesForTooltip compute open/close timestamps from timenow, adjusting for next trading day if after close or on weekends/holidays. This ensures forward-looking accuracy in tooltips.

  • Alert System: Configurable per-session, it fires notifications for pre-open (30/5 min), open, pre-close (30/5 min), close, and holidays. Alerts use alert.freq_once_per_bar to avoid spam, gated by market open status.

  • Visual Dashboard: A 6-column table is drawn with table.new, positioned via input (default bottom-center). Cells update colors based on state: active (session color at 75% opacity), pre-active (yellow), or inactive (gray). Tooltips via f_getSessionTooltip compile weekly schedules using f_formatScheduleEntry, which converts session times to user timezone, formats dates (DD/MM), weekdays (padded for alignment), and notes holidays/early closes. Time remaining uses f_formatTimeRemainingtooltip for human-readable countdowns (e.g., "1h:30m").

  • Background Coloring: On ≤1m timeframes, bgcolor applies session-specific hues (e.g., green for NYSE) at 90-95% transparency, configurable via light/dark themes.

  • User Customization: Inputs handle timezone (90+ options with DST), time format (standard/military, though not fully implemented in script), device (adjusts text padding/sizes), and theme (swaps colors for readability).


This setup combines timestamp arithmetic, conditional mapping, and array-based date iteration to create a robust, adaptive system that respects global market nuances without relying on simplistic built-in session strings.




Why It's Useful
Trading sessions drive liquidity, volatility, and price action—e.g., London open often sparks trends in forex, while NYSE influences equities. This indicator demystifies these by providing at-a-glance visuals and alerts, reducing the need for manual timezone conversions or external calendars. Background colors on low TFs help spot session overlaps (e.g., London/NY for high volume), while the table's tooltips offer quick weekly overviews, ideal for planning around holidays like Lunar New Year (HKSE-specific additions). Alerts prevent missing key events, and holiday detection avoids false expectations during closures.
For global traders, it minimizes errors in multi-asset setups; scalpers benefit from pre-open warnings, while swing traders use schedules for longer-term context. Its non-intrusive design (transparent on higher TFs) keeps charts clean, enhancing overall workflow efficiency.



How to Use It
  1. Add to Chart: Access via invite-only on TradingView; apply to any timeframe, best on intraday for backgrounds or any for the dashboard.
  2. Configure Inputs:
    • Time Settings: Select your timezone (e.g., UTC+3 Jerusalem) for accurate tooltip conversions; choose time format (standard preferred for readability).
    • Visualization Setup: Pick device (Desktop/Tablet/Mobile) for optimized text sizing/padding; select Light/Dark theme to match your chart.
    • Sessions Dashboard: Adjust table position if needed (default bottom-center).
    • Notifications Settings: Toggle alerts per exchange (e.g., enable NYSE for US focus).

  • Trading Application:
    • Visual Cues: On ≤1m charts, watch for color changes to enter/exit during active sessions. Hover table cells for schedules—current day highlighted, future/past separated, holidays marked (*).
    • Alerts: Set up in TradingView's alert manager for "alert() function calls only" to get notifications like "New York Session is about to Open in less than 5 minutes!"
    • Strategies: Use pre-open for setups (e.g., range breaks), closes for profit-taking. Combine with volume indicators during overlaps.
    • Best Practices: Test on demo; adjust alerts to avoid overload. For non-realtime, tooltips use current date for projections.


Why It's Unique and Worth Invite-Only Access
Unlike basic session highlighters that use rigid time strings or ignore holidays, this indicator integrates a custom holiday library with half-day adjustments and additional events (e.g., Buddha's Birthday for HKSE), ensuring precision across exchanges. Its tooltip system—generating timezone-converted weekly schedules with day adjustments, countdowns, and holiday notes—provides unmatched planning utility, while adaptive visuals (device/theme-aware) and granular alerts (pre-events included) elevate it beyond public tools. The logic for timestamp forward-projection, weekend skipping, and formatted entries builds on but significantly enhances built-in functions and educational examples.
This originality—protecting the proprietary blend of global calendar handling, alert gating, and interactive dashboards—justifies closed-source status. As invite-only, it delivers premium value through reliable, low-maintenance features that free traders from external apps, warranting access for those seeking an edge in session-based trading. Contact via TradingView for support.

Disclaimer
This indicator is a tool for analyzing market sessions and does not guarantee success. Trading involves risk, and past performance is not indicative of future results. Always use proper risk management.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.