OPEN-SOURCE SCRIPT

OPR Asia London US Universal Open Price Range

532
Description:
What this script does
This indicator automatically draws the Open Price Range (OPR) for up to three configurable trading sessions: Asia, London, and US. For each session, it captures the high and low over a user-defined opening window, then extends the resulting levels forward in time so traders can monitor whether price respects or breaks the opening range.
What makes it original

Most OPR indicators on TradingView are hardcoded for a single instrument (DAX, NQ, ES) and a single timezone. This script solves three problems that existing public OPR tools do not handle:

Universal — works on any asset (indices, forex, commodities, crypto) without symbol detection logic. No ticker filtering.
Per-session timezone — each of the three sessions has its own independent timezone setting. Asia runs on America/New_York, London on Europe/London, US on America/New_York by default, but all are fully configurable. This ensures correct alignment regardless of the chart's display timezone.
Cross-midnight handling — the Asia session starts at 20:00 ET (evening) and its extension target falls the next morning. The script correctly computes next-day timestamps for the extend line, a case that breaks most existing OPR implementations.

How it works
For each session the script computes a tStart and tEnd timestamp in the session's own timezone using Pine Script's timestamp() function with explicit year/month/day/hour/minute parameters. It accumulates the highest high and lowest low of all bars within the window. On the first bar after the window closes, it draws:

A filled rectangle over the OPR capture window
A thick left-edge vertical line marking the exact open
High and low horizontal lines extended to a configurable end time
An optional dotted midpoint line
A small session label (AS / LN / US, all editable)

The extend target uses a cross-midnight guard: if the extend hour falls before the session start hour in that timezone, 86,400,000 ms (one day) is added to the timestamp.
How to use it
Set Start hour/min and End hour/min to define the capture window for each session. Set Extend hour/min to control how far the high/low lines project forward. Enable or disable each session independently. All colors, line widths, and labels are customizable in the Style group.
Works on any timeframe from 1 minute to 1 hour. Tested on indices (DAX, NQ, ES), forex pairs, and Gold.

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.