Define the clock before the range

An exchange opening auction establishes an opening price under venue rules. An opening-range study measures the highest and lowest traded prices during a configured interval after a session boundary. They can share a start, but they are different mechanisms and different data objects.

The published script keys its session boundary to the symbol’s exchange session and time zone. It supports five configurable opening-range slots, including a seconds-based slot, and collapses duplicate durations. The default range is 60 minutes.

Separate formation from lock

A new exchange session initializes the range. While chart time remains inside the selected window, each bar may expand the high or low. The range locks only on a confirmed bar whose close time reaches the configured window end.

That boundary matters operationally. A forming range is path-dependent and cannot yet support a final width, breakout, retest, or extension statement. A locked range is fixed geometry for the remainder of the session.

A breakout is a confirmed-close event

After lock, the script marks the first confirmed close above the high or below the low during the exchange session. A wick beyond the boundary is not a breakout. Only the first break in each direction is recorded per session, so repeated closes outside the same boundary are not counted as independent events.

An optional width filter compares the opening-range width with a 14-session daily ATR sample. If the range falls outside the configured bounds, event signals are suppressed while the range itself remains visible. The filter changes the event sample; it does not change what prices formed the range.

Retests use an explicit state sequence

A retest cannot occur on the breakout bar. On a later bar, contact with the tolerance band moves the event into TESTING. The first confirmed close back beyond the broken boundary is HELD; the first confirmed close back inside the range is FAILED.

Tolerance can be based on daily ATR, intraday ATR, or fixed ticks. That basis controls which contacts enter the test and therefore must travel with any retest statistic. The 1.0× range extension, by contrast, is touch-based and can trigger on a wick.

Do not flatten every horizontal level into one category

The published script also exposes seventeen reference types spanning overnight, prior day, current day, premarket, prior and current week, prior and current month, and gap context. Each is built from a different window and may be developing, final, or unavailable at a different time.

For professional review, label the source, timestamp, session convention, and availability of each level. Then analyze whether it adds independent information or simply restates the same high, low, or gap already represented elsewhere.