OPEN-SOURCE SCRIPT
已更新

[Chrona] Opening Range Breakout

386
[Chrona] Opening Range Breakout

An opening-range tool for instruments that have an opening auction. It draws the
first 15 and 30 minutes of a session as a range, marks the candle that broke it,
and projects targets measured from the broken level.

WHAT IT DRAWS

- The 15-minute and 30-minute opening range of each enabled session, as a box
whose high and low freeze when the range closes. The right edge keeps
following the last printed bar until the session ends, so the box grows with
price and never extends past it.
- An optional midline through the range.
- A tag on the candle that confirmed the break — above it on an upside break,
below it on a downside one, so the side carries the direction.
- 1R and 2R targets for the 30-minute range, measured from the broken level.
- Right-axis price tags for the levels and targets of whichever session is open.
- Optional pre-market ranges: the same opening-range construction run on the
lead minutes before a session opens.

Four sessions run independently — Asia, London, New York and COMEX — each
evaluated in its own timezone.

ORIGINALITY AND UTILITY

Multi-session opening ranges are common. These are the parts that are not, and
they are the reason this exists rather than a settings preset of something else:

- The range is built from one-minute intrabars, not from chart bars. On a
15-minute chart a chart-bar implementation cannot see inside the first bar, so
its "15-minute range" is whatever the first candle happened to be. This one
requests 1-minute data and measures the real first 15 and 30 minutes, so the
box is the same box on a 1-minute chart and on an hourly one.
- Three break-confirm modes — touch, chart close, and a 5-minute close — and the
5-minute close is computed natively from time("5") buckets rather than
requested from a higher timeframe. A higher-timeframe request returns the
developing value while the bar is still forming, which is how a break appears
and then un-appears. Nothing here repaints.
- Targets are anchored to the broken level, not to the range. A level-anchored
1R sits one range-width from the level price; a range-anchored one drifts with
whichever edge is used to measure it. The two disagree on every trade, and the
level is the price actually broken.
- Each session carries its own timezone, so daylight saving is resolved per
region rather than by one global offset. London shifting a week before New
York does not move the New York range.
- Nothing is hardcoded to 09:30. Instruments with no equity open work by typing
their real hours: XAUUSD has no cash open at all, and COMEX gold's pit open is
08:20 New York time.
- The pre-market range is derived from its parent session's own window rather
than configured separately, so the two cannot drift apart when either is
edited, and its levels stay live through the parent session — the range forms
before the open and the break lands after it.
- The break tag exists because of a specific blind spot: on a 1- or 2-minute
chart you cannot see where the 5-minute bar closed. The tag marks the candle
that carried that close.

METHOD

For each enabled session the script takes the session window you set, in that
session's timezone, and masks it to weekdays. It collects one-minute highs and
lows from the session open and freezes the extremes at 15 and 30 minutes. A
break is tested against the frozen level in the confirm mode you choose. Once
broken, targets are placed at one and two range-widths from the level, and a
retest is reported when price returns to within a tenth of a range-width of it.
Everything is evaluated on confirmed bars.

ALERTS

Break up, break down, both-sides-broken, and level retest, per session and per
range. Alerts are armed in the settings, but the script's alert calls do nothing
until TradingView has an alert of its own on this indicator with the condition
"Any alert() function call".

Two things about TradingView alerts worth knowing: they fire on the realtime bar
only, never on bars that already printed, so a break that happened before the
alert existed leaves no alert behind; and TradingView saves a copy of the script
when the alert is created, so an alert keeps running the version it was made
from. Re-create alerts after updating.

REPAINT

Nothing repaints. Every value is read on confirmed bars, higher-timeframe
requests are not used, and the 5-minute confirm lands one chart bar after the
5-minute close by construction rather than being back-dated.

LIMITATIONS

- The range needs one-minute data. How far back that data is available varies by
timeframe and by your TradingView plan, so on a lower plan the historical
boxes stop earlier than they do on a higher one. "Prior days to keep" defaults
to 1, which keeps this within the recent sessions most of the time.
- On a 1-minute chart and below there is no lower timeframe to request, so the
script falls back to the chart bars themselves — which at those timeframes are
already at or finer than 1-minute resolution.
- Sessions are only as correct as the hours you give them. The defaults are
reasonable for index futures; other instruments need their real hours typed in.
- An opening range assumes an opening. On instruments that trade continuously
with no auction, the pre-market range in particular is a borrowed idea rather
than a measured one.

This is an analysis tool, not financial advice.
發行說明
Fixed: on charts below 1 minute (30-second, 15-second) the script could fail to load with a runtime error. Fixed: the 5-minute break tag, on 2-, 3- and 4-minute charts, could mark the wrong candle and the wrong price — it now always names the candle that carried the real 5-minute close, matching what the 1-minute and 5-minute charts already showed. No inputs changed.
發行說明
Fixed: the optional range midline started partway across the box instead of at the session open, leaving the first part of the range without a midline. It now spans the full width of the box. No inputs changed.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。