OPEN-SOURCE SCRIPT

Opening Range Breakout Statistics (ORB) (kronos)

1 196
Opening Range Breakout (ORB) Statistics: Retest & Extension (kronos)

This indicator turns a completed opening range into a compact statistical read of what historically happened next. The default summary keeps the chart clean and focuses on three questions: which side broke first, how often the selected extension was reached, and what the current session has already confirmed.

How it works

The script builds an opening range from a market preset or custom session. When the range closes, its width and close location are frozen. Historical sessions are then filtered by the selected similarity rule. The current session is never included in its own sample.

  • First Break shows UP, DOWN and OTHER in separate cells. OTHER combines no-break sessions and same-bar two-sided breaks because OHLC data cannot prove an intrabar order.
  • UP or DOWN receives the stronger highlight only when that directional outcome leads both the opposite direction and OTHER.
  • Extension shows the historical share that reached the selected range multiple. Once a directional first break exists, the sample switches to comparable historical breaks in that direction.
  • Based On shows the sample size and effective similarity scope behind the extension statistic.
  • Today shows the confirmed first-break direction, broken-edge retest state and active extension state.


Opening range presets

  • US Cash 09:30 New York
  • London Cash 08:00 London
  • Tokyo Cash 09:00 Tokyo
  • Crypto 00:00 UTC
  • Custom session and timezone


Opening Range Length supports 15, 30 and 60 minutes for the market presets. Custom mode uses the custom Opening Range and Outcome Window fields.

Historical matching

Auto is the recommended mode. Before a break it uses the most specific sample that reaches the target sample size. After a directional break it resolves a separate sample for that break direction. Manual filters can instead use the same range setup, same range size, same range close, or all sessions.

Range size is classified from historical normalized opening-range widths. The current width uses a half-tie percentile rank, so equal historical widths do not receive an artificial upper-rank bias. The range close is classified into lower, middle or upper thirds.

Outcome rules

Confirmed Close requires a closed bar beyond the opening-range edge. Wick Beyond Range uses strict high/low breaches. Exact touches of the opening-range boundary are not breaks. If a single wick bar crosses both edges before a direction is established, the result is recorded as a same-bar two-sided break rather than assigning an order that the chart data cannot prove.

The broken-edge and midpoint retests can only be confirmed on a later bar than the first break. Extension targets count an exact touch.

Chart display

The opening-range box, high, low and optional midpoint remain unchanged after the range locks. Only the target in the first-break direction is shown. The OR and target lines extend one chart bar beyond the latest processed bar, matching the price-label offset on every supported timeframe. Event labels are optional and off by default.

Inputs

  • Preset - Market/session preset. Default: US Cash 09:30 NY.
  • Opening Range Length - 15, 30 or 60 minutes. Default: 30 Minutes.
  • Max History Sessions - Maximum retained completed sessions. Default: 250.
  • Target Sample Size - Desired sample size for adaptive matching. Default: 20.
  • History Filter - Auto, same range setup, same range size, same range close, or all sessions. Default: Auto (Recommended).
  • Minimum Session Data % - Required outcome-window coverage. Default: 80.
  • Break Confirmation - Confirmed Close or Wick Beyond Range. Default: Confirmed Close.
  • Extension Target - Range-width multiple beyond the broken edge. Default: 1.0.
  • Display - Opening range, midpoint, active target, price labels, event labels and compact summary.


Alerts

Alerts are available for opening-range lock, first break up, first break down, same-bar two-sided break, edge retest, midpoint retest, opposite edge, selected extension and both-sides completion. State changes are processed on confirmed chart bars.

Limitations

The indicator uses chart-timeframe OHLC bars only. It does not reconstruct intrabar sequencing. Session windows must align with the chart timeframe, and incomplete opening ranges are excluded. Historical percentages describe the selected sample and are not forecasts.

This script is a charting tool for educational purposes. It does not provide financial advice and does not predict future price movement. Trading carries risk; decisions and their outcome remain yours.

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.