PROTECTED SOURCE SCRIPT
Prev Day, Premarket, 5m Open

Description of the Script
This script is a Pine Script (version 5) indicator designed for use in TradingView. It overlays customizable price range lines and backgrounds on a chart to highlight key trading ranges based on different time periods and sessions. The indicator focuses on the following ranges:
Daily Range: Displays the high and low prices from the previous trading day (9:30 AM to 4:00 PM ET).
Premarket Range: Shows the high and low prices during the premarket session (4:00 AM to 9:29 AM ET) of the current day.
5-Minute Opening Range: Captures the high and low prices during the first 5 minutes of the regular trading session (9:30 AM to 9:35 AM ET).
GC Sessions (Gold Commodity): Optionally displays the high and low of the previous day's GC session (9:00 AM to 2:30 PM ET) and London Fix windows (5:00–6:00 AM and 9:30–10:30 AM ET on the current day).
CL Sessions (Crude Oil): Optionally displays the high and low of the previous day's CL session (9:00 AM to 2:30 PM ET) and the EIA window (10:00–11:00 AM ET on Wednesdays).
Each range is represented by horizontal lines (top and bottom) with customizable colors, styles (solid, dashed, dotted), and widths. Background shading between the high and low lines can also be enabled with adjustable colors and transparency. Labels are added to identify each range (e.g., "PDH" for Previous Day High, "PMH" for Premarket High, etc.). The script adjusts for time zones via a user-defined offset and allows manual override of the previous trading day.
Instructions for Setting the Inputs
The script provides a variety of customizable inputs grouped by range type. Below are instructions for setting each input category:
General Settings
Timezone Offset (hours): Adjusts the script's time calculations to your local timezone relative to UTC. Enter the number of hours to subtract from UTC (e.g., -4 for Eastern Time during Daylight Saving Time, -5 during Standard Time). Range: -12 to +12.
Previous Day Settings
Previous Trading Day Override (YYYY-MM-DD): Allows manual specification of the previous trading day in "YYYY-MM-DD" format (e.g., "2025-03-19"). Leave blank for automatic detection (defaults to the prior day). This override expires at midnight ET the next day.
Daily Range Customization
Daily Top Line Color: Choose the color for the previous day's high line (default: green).
Daily Top Line Style: Select the line style (solid, dashed, dotted; default: solid).
Daily Top Line Width: Set the line thickness (1 to 5; default: 2).
Daily Bottom Line Color: Choose the color for the previous day's low line (default: red).
Daily Bottom Line Style: Select the line style (solid, dashed, dotted; default: solid).
Daily Bottom Line Width: Set the line thickness (1 to 5; default: 2).
Daily Show Background?: Enable/disable background shading between the high and low (default: true).
Daily Background Color: Choose the background color (default: orange).
Daily Background Transparency: Set transparency level (0 = opaque, 100 = fully transparent; default: 92).
Premarket Range Customization
Premarket Top Line Color: Choose the color for the premarket high line (default: green).
Premarket Top Line Style: Select the line style (solid, dashed, dotted; default: solid).
Premarket Top Line Width: Set the line thickness (1 to 5; default: 2).
Premarket Bottom Line Color: Choose the color for the premarket low line (default: red).
Premarket Bottom Line Style: Select the line style (solid, dashed, dotted; default: solid).
Premarket Bottom Line Width: Set the line thickness (1 to 5; default: 2).
Premarket Show Background?: Enable/disable background shading (default: true).
Premarket Background Color: Choose the background color (default: blue).
Premarket Background Transparency: Set transparency level (0 to 100; default: 92).
5-Minute Opening Range Customization
5min Opening Top Line Color: Choose the color for the opening range high line (default: black).
5min Opening Top Line Style: Select the line style (solid, dashed, dotted; default: solid).
5min Opening Top Line Width: Set the line thickness (1 to 5; default: 2).
5min Opening Bottom Line Color: Choose the color for the opening range low line (default: black).
5min Opening Bottom Line Style: Select the line style (solid, dashed, dotted; default: solid).
5min Opening Bottom Line Width: Set the line thickness (1 to 5; default: 2).
GC Special Sessions
Show GC Session Range (9:00 AM - 2:30 PM ET)?: Enable/disable the GC session range from the previous day (default: false).
GC Session Top Color: Choose the color for the GC session high line (default: green).
GC Session Bottom Color: Choose the color for the GC session low line (default: red).
Show London Fix Windows (5-6 AM, 9:30-10:30 AM ET)?: Enable/disable the London Fix windows for the current day (default: false).
London Fix Top Color: Choose the color for the London Fix high line (default: green).
London Fix Bottom Color: Choose the color for the London Fix low line (default: red).
CL Special Sessions
Show CL Session Range (9:00 AM - 2:30 PM ET)?: Enable/disable the CL session range from the previous day (default: false).
CL Session Top Color: Choose the color for the CL session high line (default: green).
CL Session Bottom Color: Choose the color for the CL session low line (default: red).
Show EIA Window (Wed, 10-11 AM ET)?: Enable/disable the EIA window for Wednesdays (default: false).
EIA Window Top Color: Choose the color for the EIA high line (default: green).
EIA Window Bottom Color: Choose the color for the EIA low line (default: red).
How to Use
Add to Chart: Copy the script into TradingView's Pine Editor, then add it to your chart.
Adjust Inputs: Open the indicator settings by double-clicking it on the chart. Modify the inputs as described above to suit your preferences.
Verify Timezone: Ensure the "Timezone Offset" matches your desired timezone for accurate range calculations.
Optional Overrides: Use the "Previous Trading Day Override" if you need to analyze a specific past day, ensuring the format is correct (e.g., "2025-03-19").
This indicator is particularly useful for traders who rely on key price levels from previous sessions, premarket activity, or specific commodity-related time windows (GC and CL).
This script is a Pine Script (version 5) indicator designed for use in TradingView. It overlays customizable price range lines and backgrounds on a chart to highlight key trading ranges based on different time periods and sessions. The indicator focuses on the following ranges:
Daily Range: Displays the high and low prices from the previous trading day (9:30 AM to 4:00 PM ET).
Premarket Range: Shows the high and low prices during the premarket session (4:00 AM to 9:29 AM ET) of the current day.
5-Minute Opening Range: Captures the high and low prices during the first 5 minutes of the regular trading session (9:30 AM to 9:35 AM ET).
GC Sessions (Gold Commodity): Optionally displays the high and low of the previous day's GC session (9:00 AM to 2:30 PM ET) and London Fix windows (5:00–6:00 AM and 9:30–10:30 AM ET on the current day).
CL Sessions (Crude Oil): Optionally displays the high and low of the previous day's CL session (9:00 AM to 2:30 PM ET) and the EIA window (10:00–11:00 AM ET on Wednesdays).
Each range is represented by horizontal lines (top and bottom) with customizable colors, styles (solid, dashed, dotted), and widths. Background shading between the high and low lines can also be enabled with adjustable colors and transparency. Labels are added to identify each range (e.g., "PDH" for Previous Day High, "PMH" for Premarket High, etc.). The script adjusts for time zones via a user-defined offset and allows manual override of the previous trading day.
Instructions for Setting the Inputs
The script provides a variety of customizable inputs grouped by range type. Below are instructions for setting each input category:
General Settings
Timezone Offset (hours): Adjusts the script's time calculations to your local timezone relative to UTC. Enter the number of hours to subtract from UTC (e.g., -4 for Eastern Time during Daylight Saving Time, -5 during Standard Time). Range: -12 to +12.
Previous Day Settings
Previous Trading Day Override (YYYY-MM-DD): Allows manual specification of the previous trading day in "YYYY-MM-DD" format (e.g., "2025-03-19"). Leave blank for automatic detection (defaults to the prior day). This override expires at midnight ET the next day.
Daily Range Customization
Daily Top Line Color: Choose the color for the previous day's high line (default: green).
Daily Top Line Style: Select the line style (solid, dashed, dotted; default: solid).
Daily Top Line Width: Set the line thickness (1 to 5; default: 2).
Daily Bottom Line Color: Choose the color for the previous day's low line (default: red).
Daily Bottom Line Style: Select the line style (solid, dashed, dotted; default: solid).
Daily Bottom Line Width: Set the line thickness (1 to 5; default: 2).
Daily Show Background?: Enable/disable background shading between the high and low (default: true).
Daily Background Color: Choose the background color (default: orange).
Daily Background Transparency: Set transparency level (0 = opaque, 100 = fully transparent; default: 92).
Premarket Range Customization
Premarket Top Line Color: Choose the color for the premarket high line (default: green).
Premarket Top Line Style: Select the line style (solid, dashed, dotted; default: solid).
Premarket Top Line Width: Set the line thickness (1 to 5; default: 2).
Premarket Bottom Line Color: Choose the color for the premarket low line (default: red).
Premarket Bottom Line Style: Select the line style (solid, dashed, dotted; default: solid).
Premarket Bottom Line Width: Set the line thickness (1 to 5; default: 2).
Premarket Show Background?: Enable/disable background shading (default: true).
Premarket Background Color: Choose the background color (default: blue).
Premarket Background Transparency: Set transparency level (0 to 100; default: 92).
5-Minute Opening Range Customization
5min Opening Top Line Color: Choose the color for the opening range high line (default: black).
5min Opening Top Line Style: Select the line style (solid, dashed, dotted; default: solid).
5min Opening Top Line Width: Set the line thickness (1 to 5; default: 2).
5min Opening Bottom Line Color: Choose the color for the opening range low line (default: black).
5min Opening Bottom Line Style: Select the line style (solid, dashed, dotted; default: solid).
5min Opening Bottom Line Width: Set the line thickness (1 to 5; default: 2).
GC Special Sessions
Show GC Session Range (9:00 AM - 2:30 PM ET)?: Enable/disable the GC session range from the previous day (default: false).
GC Session Top Color: Choose the color for the GC session high line (default: green).
GC Session Bottom Color: Choose the color for the GC session low line (default: red).
Show London Fix Windows (5-6 AM, 9:30-10:30 AM ET)?: Enable/disable the London Fix windows for the current day (default: false).
London Fix Top Color: Choose the color for the London Fix high line (default: green).
London Fix Bottom Color: Choose the color for the London Fix low line (default: red).
CL Special Sessions
Show CL Session Range (9:00 AM - 2:30 PM ET)?: Enable/disable the CL session range from the previous day (default: false).
CL Session Top Color: Choose the color for the CL session high line (default: green).
CL Session Bottom Color: Choose the color for the CL session low line (default: red).
Show EIA Window (Wed, 10-11 AM ET)?: Enable/disable the EIA window for Wednesdays (default: false).
EIA Window Top Color: Choose the color for the EIA high line (default: green).
EIA Window Bottom Color: Choose the color for the EIA low line (default: red).
How to Use
Add to Chart: Copy the script into TradingView's Pine Editor, then add it to your chart.
Adjust Inputs: Open the indicator settings by double-clicking it on the chart. Modify the inputs as described above to suit your preferences.
Verify Timezone: Ensure the "Timezone Offset" matches your desired timezone for accurate range calculations.
Optional Overrides: Use the "Previous Trading Day Override" if you need to analyze a specific past day, ensuring the format is correct (e.g., "2025-03-19").
This indicator is particularly useful for traders who rely on key price levels from previous sessions, premarket activity, or specific commodity-related time windows (GC and CL).
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarlo liberamente e senza alcuna limitazione – per saperne di più clicca qui.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarlo liberamente e senza alcuna limitazione – per saperne di più clicca qui.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.