INDICATOR MANUAL
Opening range breakout indicatorOpening Range & Key Levels [AFD] · full manual · published to TradingView
Track five opening ranges from formation through extension alongside 17 optional session and higher-timeframe references.
Start here
What the indicator does, the questions it can help answer, and its fresh-install defaults.
The indicator can register four minute-based opening ranges and one seconds-based range. Duplicate durations collapse into one range. Each active range develops during its window and locks after the window closes.
A confirmed close beyond a locked boundary records a break. A return to the configured tolerance starts a retest; the first testing close resolves it as HELD or FAILED. Measured extensions are calculated from the frozen range width.
Seventeen optional overnight, day, pre-market, week, and month references plus an opening-gap level can be styled and labeled independently. Current-week and current-month extremes continue developing.
Fresh-install defaults8 documented defaults
Swipe or scroll horizontally to see every column.
| Area | Default | Result |
|---|---|---|
| Quick Start preset | Default | Keeps the 60-minute OR slot enabled and respects the enabled core key-level rows. |
| Opening ranges | OR #4 · 60 minutes | The other minute slots and the seconds slot start off. |
| Core key levels | ONH, ONL, PDO, PDH, PDL, PDC | These six rows start enabled; OPEN, pre-market, week, month, and GAP rows start off. |
| Range visuals | Boxes and OR tags on | Mid lines, event labels, right-edge status tags, and all four extension drawings start off. |
| Key-level labels | Per level · 25-bar offset | Enabled rows show names and prices; lines start at the overnight boundary and can extend to labels. |
| Break and retest | Daily ATR · 0.1 | Killzone, width, and volume filters start off. |
| Dashboard and weighted lines | Off | Dashboard, intraday VWAP, overnight VWAP, and continuous VWMA are opt-in. |
| Dynamic alert text | On | Any alert() function call can include the symbol, range or key-level identity, and price. |
How it works
How the indicator turns chart data into the states and drawings you see.
Range registration
At the exchange-session boundary, the indicator registers each effective unique duration. Slots 1–4 use minutes; slot 5 uses seconds and requires a compatible seconds chart.
Forming and lock
High and low update during the opening window. When a confirmed bar reaches the window end, the range locks and its midpoint and 0.5×, 1.0×, 1.5×, and 2.0× extensions use the frozen width.
Break and retest
A wick does not establish a break. The first confirmed close beyond each side can arm a retest. Returning to the tolerance starts TESTING; the next deciding close records HELD or FAILED.
Event filters
The optional killzone consumes events that first occur inside its window rather than deferring them. The width filter leaves levels visible but suppresses events outside the selected daily-ATR range. Volume confirmation adds a separate condition.
Key-level lifecycle
Prior-day, week, and month values are snapshots from completed windows. ONH/ONL and PMH/PML need extended-hours history. CWH/CWL and CMoH/CMoL update when current-period extremes change.
Opening gap
A gap is admitted when today’s open differs from the prior close by at least the selected percentage. It can display as a line or zone, show fill progress, keep a filled record, and optionally freeze at fill.
VWAP, VWMA, and dashboard
Intraday VWAP resets at the session open, overnight VWAP at the prior session close, and VWMA does not reset. The optional dashboard reports range states, bias context, warnings, prices, gap progress, and broken key levels.
Output and state reference10 documented states
Swipe or scroll horizontally to see every column.
| Output or state | When it appears | Meaning |
|---|---|---|
| FORMING | Opening window active | The range high and low are still developing. |
| LOCKED · INSIDE | Window closed | The frozen range has no recorded directional break. |
| BROKE ↑ / ↓ | Confirmed close | Price closed beyond the locked high or low. |
| RETEST | Price returns to tolerance | The broken boundary is being tested. |
| RETEST HELD | First deciding close beyond level | The close remained on the broken side of the boundary. |
| RETEST FAILED | First deciding close inside range | The close returned through the boundary into the range. |
| EXTENSION | Touch of a frozen projection | Price reached an enabled multiple of the locked range width. |
| WIDTH FILTERED | Locked width outside filter | The range remains visible while its break and retest events are suppressed. |
| GAP FILLED | Price returns to prior close | The configured opening gap reached 100% fill. |
| DATA WARNING | Incompatible chart or history | A slot or reference lacks the timeframe, session, or loaded data it requires. |
Settings
The 216 inputs include five OR rows, four extension rows, seventeen six-control key-level rows, gap controls, filters, dashboard options, three weighted references, and alert text. The repeated rows appear first as compact default matrices.
Opening range slots
25 mapped inputs
Swipe or scroll horizontally to see every column.
| Row | Enabled | Window | Color | Style | Width |
|---|---|---|---|---|---|
| OR #1 | OffToggle | 5 minWhole number | AquaColor | SolidChoice / text | 2Whole number |
| OR #2 | OffToggle | 15 minWhole number | OrangeColor | SolidChoice / text | 2Whole number |
| OR #3 | OffToggle | 30 minWhole number | GreenColor | SolidChoice / text | 2Whole number |
| OR #4 | OnToggle | 60 minWhole number | FuchsiaColor | SolidChoice / text | 2Whole number |
| Seconds OR | OffToggle | 30 secWhole number | WhiteColor | SolidChoice / text | 2Whole number |
Opening range extensions
20 mapped inputs
Swipe or scroll horizontally to see every column.
| Row | Shown | Color | Style | Width | Price tag |
|---|---|---|---|---|---|
| 1.0× | OffToggle | GrayColor | DashedChoice / text | 1Whole number | OnToggle |
| 1.5× | OffToggle | GrayColor | DashedChoice / text | 1Whole number | OnToggle |
| 2.0× | OffToggle | GrayColor | DashedChoice / text | 1Whole number | OnToggle |
| 0.5× | OffToggle | GrayColor | DashedChoice / text | 1Whole number | OnToggle |
Seventeen key levels
102 mapped inputs
Swipe or scroll horizontally to see every column.
| Row | Shown | Color | Style | Width | Label | Price |
|---|---|---|---|---|---|---|
| ONH | OnToggle | PurpleColor | DottedChoice / text | 1Whole number | OnToggle | OnToggle |
| ONL | OnToggle | PurpleColor | DottedChoice / text | 1Whole number | OnToggle | OnToggle |
| PDO | OnToggle | GrayColor | DashedChoice / text | 1Whole number | OnToggle | OnToggle |
| PDH | OnToggle | RedColor | SolidChoice / text | 2Whole number | OnToggle | OnToggle |
| PDL | OnToggle | LimeColor | SolidChoice / text | 2Whole number | OnToggle | OnToggle |
| PDC | OnToggle | GrayColor | DashedChoice / text | 1Whole number | OnToggle | OnToggle |
| OPEN | OffToggle | YellowColor | DashedChoice / text | 1Whole number | OnToggle | OnToggle |
| PMH | OffToggle | TealColor | DottedChoice / text | 1Whole number | OnToggle | OnToggle |
| PML | OffToggle | TealColor | DottedChoice / text | 1Whole number | OnToggle | OnToggle |
| PWH | OffToggle | BlueColor | SolidChoice / text | 1Whole number | OnToggle | OnToggle |
| PWL | OffToggle | BlueColor | SolidChoice / text | 1Whole number | OnToggle | OnToggle |
| CWH | OffToggle | BlueColor | DashedChoice / text | 1Whole number | OnToggle | OnToggle |
| CWL | OffToggle | BlueColor | DashedChoice / text | 1Whole number | OnToggle | OnToggle |
| PMOH | OffToggle | MaroonColor | SolidChoice / text | 1Whole number | OnToggle | OnToggle |
| PMOL | OffToggle | MaroonColor | SolidChoice / text | 1Whole number | OnToggle | OnToggle |
| CMOH | OffToggle | MaroonColor | DashedChoice / text | 1Whole number | OnToggle | OnToggle |
| CMOL | OffToggle | MaroonColor | DashedChoice / text | 1Whole number | OnToggle | OnToggle |
⚡ Quick Start1 input
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Presetpreset | Choice / text | Default | Default · Minimal · Full · Custom |
🎨 Opening Range Visuals11 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| OR label modeor_label_mode | Choice / text | Per toggle | Per toggle · All on · All off |
| Show mid lineshow_mid | Toggle | Off | — |
| Show range boxesshow_range_box | Toggle | On | — |
| Show event labels (break/retest)show_ev_labels | Toggle | Off | — |
| Label textev_txt_col | Color | Black | — |
| Backgroundev_bg_col | Color | Gray | — |
| Match OR colorev_match_or | Toggle | On | — |
| Show OR / extension tagsshow_or_tags | Toggle | On | — |
| Show price in OR tagsor_tag_price | Toggle | On | — |
| Show right-edge status tagshow_status_tag | Toggle | Off | — |
| OR lines stop ator_extend | Choice / text | Session end | Session end · OR window end |
🔑 Key Levels8 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Key Level Presetskl_preset | Choice / text | Default acronyms | Default acronyms · Full words · Custom |
| Key level labelskl_lbl_mode | Choice / text | Per level | Per level · All on · All off |
| Key level extendkl_extend | Choice / text | Session | Session · Right edge |
| Extend lines leftkl_left_en | Toggle | On | — |
| Label offset (bars)kl_lbl_off | Whole number | 25 | Min 0 · Max 499 |
| Extend lines to labelkl_line_to_lbl | Toggle | On | — |
| Show key level break labelskl_ev_en | Toggle | Off | — |
| Rename levelskl_rename | Choice / text | Blank | — |
⇅ Price GAP13 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| GAPgap_en | Toggle | Off | — |
| Colorgap_col | Color | Silver | — |
| Stylegap_sty | Choice / text | Dotted | Solid · Dashed · Dotted |
| Widthgap_w | Whole number | 1 | Min 1 · Max 4 |
| Lblgap_lbl | Toggle | On | — |
| $gap_px | Toggle | On | — |
| Min gap %gap_min_pct | Decimal | 0.1 | Min 0.0 · Step 0.05 |
| Keep after fillgap_keep | Toggle | Off | — |
| Displaygap_mode | Choice / text | Line only | Line only · Zone |
| Colorgap_box_col | Color | Silver | — |
| Show Midpointgap_mid_en | Toggle | Off | — |
| Show fill %gap_fill_dyn | Toggle | On | — |
| After fillgap_after | Choice / text | Stop at fill | Stop at fill · Extend right |
📊 Dashboard7 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Show dashboardshow_dash | Toggle | Off | — |
| Positiondash_pos | Choice / text | Top Right | Top Right · Top Left · Bottom Right · Bottom Left |
| Text sizedash_size | Choice / text | Small | Tiny · Small · Normal |
| Show bias rowdash_bias | Toggle | On | — |
| Show broken key levelsdash_kl | Toggle | On | — |
| Show prices in dashboarddash_prices | Toggle | On | — |
| Status color modedash_color_mode | Choice / text | Directional | Directional · Neutral |
⚡ Breakout & Retest14 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Killzone filterkz_en | Toggle | Off | — |
| kz sesskz_sess | Session | 1200-1330 | — |
| Highlight killzonekz_show | Toggle | Off | — |
| Colorkz_col | Color | Red · 88% transparent | — |
| Labelkz_lbl_en | Toggle | On | — |
| Retest toleranceretest_tol_type | Choice / text | Daily ATR | Daily ATR · Intraday ATR · Fixed Ticks |
| Valueretest_tol_val | Decimal | 0.1 | Min 0.0 · Step 0.05 |
| ATR lengthatr_len | Whole number | 14 | Min 1 |
| OR width filterwidth_filt_en | Toggle | Off | — |
| min ×daily ATRwidth_min_atr | Decimal | 0.1 | Min 0.0 · Step 0.05 |
| max ×daily ATRwidth_max_atr | Decimal | 1.0 | Min 0.05 · Step 0.1 |
| Volume confirmationvol_conf_en | Toggle | Off | — |
| × 20-bar avgvol_conf_mult | Decimal | 1.5 | Min 0.5 · Step 0.25 |
| Show volume tag on breakout labelsshow_vol_tag | Toggle | Off | — |
📈 VWAP14 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Intraday VWAPvw1_en | Toggle | Off | — |
| Colorvw1_col | Color | Blue | — |
| Stylevw1_sty | Choice / text | Solid | Solid · Dashed · Dotted |
| Widthvw1_w | Whole number | 1 | Min 1 · Max 4 |
| Overnight VWAPvw2_en | Toggle | Off | — |
| Colorvw2_col | Color | Purple | — |
| Stylevw2_sty | Choice / text | Dotted | Solid · Dashed · Dotted |
| Widthvw2_w | Whole number | 1 | Min 1 · Max 4 |
| Continuous VWMAvw3_en | Toggle | Off | — |
| Lengthvw3_len | Whole number | 20 | Min 1 |
| Colorvw3_col | Color | Gray | — |
| Stylevw3_sty | Choice / text | Solid | Solid · Dashed · Dotted |
| Widthvw3_w | Whole number | 1 | Min 1 · Max 4 |
| Show VWAPs for last N daysvw_days | Whole number | 3 | Min 1 · Max 30 |
🔔 Alerts1 input
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Dynamic alert textdyn_alerts | Toggle | On | — |
Alerts and limitations
What can notify you, what can change the output, and what the indicator cannot establish.
10 fixed alert conditions
Confirmed close above an opening-range high.
Confirmed close below an opening-range low.
An opening-range retest resolved HELD.
An opening-range retest resolved FAILED.
Price touched a 1.0× opening-range extension.
An OR break met the configured volume threshold.
Confirmed close crossed above a key level.
Confirmed close crossed below a key level.
A key-level retest resolved HELD.
A key-level retest resolved FAILED.
Limits to keep visible
- This is a single-timeframe script. A chart interval larger than, or poorly aligned with, a short opening window can approximate its boundary.
- The seconds slot needs a seconds chart at or below the selected duration; otherwise the dashboard reports a warning.
- Session open, close, and timezone follow the symbol’s exchange context and the chart’s available session data.
- ONH, ONL, PMH, and PML need extended-hours data. Prior week and month values need enough loaded history.
- Current-week and current-month highs and lows are developing values, not completed-period snapshots.
- Killzone, width, and volume filters change which events are recorded; they do not change the already drawn locked range itself.
- The 1.0× extension alert is touch-based, while range and key-level breaks are confirmed-close events.
- Levels and dashboard terms describe configured conditions. They are not trade recommendations or risk controls.
Troubleshooting
Start with what you see on the chart. Each answer explains the likely cause and the first setting, timeframe, or data condition to check.
Why do two enabled opening ranges show as one?
The two slots resolve to the same duration, so the script combines them instead of drawing duplicate ranges. Compare the effective duration in each enabled slot and change one if you want two separate windows.
Why did price wick outside the range without recording a Break?
A Break needs a completed candle to close beyond the range or key level. The wick shows an intrabar test, not a confirmed Break. Wait for the candle to close before deciding that the event is missing.
Why is the seconds opening range showing a warning?
The chart interval is too large to build that seconds window accurately. Use a seconds chart at or below the selected range duration, or turn off the seconds slot when working on a higher interval.
Why are overnight or pre-market levels blank?
Those levels need extended-hours bars. Turn on extended-hours data for the chart and load enough history to include the overnight or pre-market window. If the feed does not provide those bars, the levels will remain blank.
Why can I see the range when it says WIDTH FILTERED?
The range still formed and locked, but its width fell outside your event filter. The drawing remains for context while Break and Retest events are suppressed. Adjust or disable the width filter if you want that range to generate events.
Why did an event inside the killzone never appear later?
The killzone filter rejects an event that first happens inside its blocked window; it does not save the event for later. Change or disable the killzone if you want those events recorded.