OPEN-SOURCE SCRIPT
Telah dikemas kini

RTH Levels: VWAP + PDH/PDL + ONH/ONL + IB

420
Algo Index — Levels Pro (ONH/ONL • PDH/PDL[RTH] • VWAP±Bands • IB • Gaps)

Purpose. A session-aware, non-repainting levels tool for intraday decision-making. Designed for futures and indices, with clean visuals, alerts, and a one-click Minimal Mode for screenshot-ready charts.

What it plots
• PDH/PDL (RTH-only) – Prior Regular Trading Hours high/low, computed intraday and frozen at the RTH close (no 24h mix-ups, no repainting).
• ONH/ONL – Prior Overnight high/low, held throughout RTH.
• RTH VWAP with ±σ bands – Volume-weighted variance, reset each RTH.
• Initial Balance (IB) – First N minutes of RTH, plus 1.5× / 2.0× extensions after IB completes.
• Today’s RTH Open & Prior RTH Close – With gap detection and “gap filled” alert.
• Killzone shading – NY Open (09:30–10:30 ET) and Lunch (11:15–13:30 ET).
• Values panel (top-right) – Each level with live distance in points & ticks.
• Right-edge level tags – With anti-overlap (stagger + vertical jitter).
• Price-scale tags – Native trackprice markers that always “stick” to the axis.



New in v6.4
• Minimal Mode: one click for a clean look (thinner lines, VWAP bands/IB extensions hidden, on-chart right-edge labels off; price-scale tags remain).
• Theme presets: Dark Hi-Contrast / Light Minimal / Futures Classic / Muted Dark.
• Anti-overlap controls: horizontal staggering, vertical jitter, and baseline offset to keep tags readable even when levels cluster.



Quick start (2 minutes)
1. Add to chart → keep defaults.
2. Sessions (ET):
• RTH Session default: 09:30–16:00 (US equities cash hours).
• Overnight Session default: 18:00–09:29.
Adjust for your market if you use different “day” hours (e.g., many use 08:20–13:30 ET for COMEX Gold).
3. Theme & Minimal Mode: pick a Theme Preset; enable Minimal Mode for screenshots.
4. Visibility: toggle PD/ON/VWAP/IB/References/Panel to taste.
5. Right-edge labels: turn Show Right-Edge Labels on. If they crowd, tune:
• Anti-overlap: min separation (ticks)
• Horizontal offset per tag (bars)
• Vertical jitter per step (ticks)
• Right-edge baseline offset (bars)
6. Alerts: open Add alert → Condition: [Levels Pro] and pick the events you want.



How levels are computed (no repainting)
• PDH/PDL: Intraday H/L are accumulated only while in RTH and saved at RTH close for “yesterday’s” values.
• ONH/ONL: Accumulated across the defined Overnight window and then held during RTH.
• RTH VWAP & ±σ: Volume-weighted mean and standard deviation, reset at the RTH open.
• IB: First N minutes of RTH (default 60). Extensions (1.5×/2.0×) appear after IB completes.
• Gaps: Today’s RTH open vs prior RTH close; “Gap Filled” triggers when price trades back to prior close.



Practical playbooks (how to trade around the levels)

1) PDH/PDL interactions
• Rejection: Price taps PDH/PDL then closes back inside → mean-reversion toward VWAP/IB.
• Acceptance: Close/hold beyond PDH/PDL with momentum → continuation to next HTF/IB target.
• Alert: PD Touch/Break.

2) ONH/ONL “taken”
• Often one ON extreme is taken during RTH. ONH Taken / ONL Taken → check if it’s a clean break or sweep & reclaim.
• Sweep + reclaim near VWAP can fuel rotations through the ON range.

3) VWAP ±σ framework
• Balanced: First tag of ±1σ often reverts toward VWAP.
• Trend: Persistent trade beyond ±1σ + IB break → target ±2σ/±3σ.
• Alerts: VWAP Cross and VWAP Reject (cross then immediate fail back).

4) IB breaks
• After IB completes, a clean IB break commonly targets 1.5× and sometimes 2.0×.
• Quick return inside IB = possible fade back to the opposite IB edge/VWAP.
• Alerts: IB Break Up / Down.

5) Gaps
• Gap-and-go: Opening drive away from prior close + VWAP support → trend until IB completion.
• Gap-fill: Weak open and VWAP overhead/underfoot → trade toward prior close; manage on Gap Filled alert.

Pro tip: Stack confluences (e.g., ONL sweep + VWAP reclaim + IB hold) and respect your execution rules (e.g., require a 5-minute close in direction, or your order-flow confirmation).



Inputs you’ll actually touch
• Sessions (ET): Session Timezone, RTH Session, Overnight Session.
• Visibility: toggles for PD/ON/VWAP/IB/Ref/Panel.
• VWAP bands: set σ multipliers (±1/±2/±3).
• IB: duration (minutes) and extension multipliers (1.5× / 2.0×).
• Style & Theme: Theme Preset, Main Line Width, Trackprice, Minimal Mode, and anti-overlap controls.



Alerts included
• PD Touch/Break — High ≥ PDH or Low ≤ PDL
• ONH Taken / ONL Taken — First in-RTH take of ONH/ONL
• VWAP Cross — Close crosses VWAP
• VWAP Reject — Cross then immediate fail back
• IB Break Up / Down — Break of IB High/Low after IB completes
• Gap Filled — Price trades back to prior RTH close

Setup: Add alert → Condition: Algo Index — Levels Pro → choose event → message → Notify on app/email.



Panel guide

The top-right panel shows each level plus live distance from last price:

LevelValue (Δpoints | Δticks)

Coloring: green if level is below current price, red if above.



Styling & screenshot tips
• Use Theme Preset that matches your chart.
• For dark charts, “Dark Hi-Contrast” with Main Line Width = 3 works well.
• Enable Trackprice for crisp axis tags that always stick to the right edge.
• Turn on Minimal Mode for cleaner screenshots (no VWAP bands or IB extensions, on-chart tags off; price-scale tags remain).
• If tags crowd, increase min separation (ticks) to 30–60 and horizontal offset to 3–5; add vertical jitter (4–12 ticks) and/or push tags farther right with baseline offset (bars).



Behavior & limitations
• Levels are computed incrementally; tables refresh on the last bar for efficiency.
• Right-edge labels are placed at bar_index + offset and do not track extra right-margin scrolling (TradingView limitation). The price-scale tags (from trackprice) do track the axis.
• “RTH” is what you define in inputs. If your market uses different day hours, change the session strings so PDH/PDL reflect your definition of “yesterday’s session.”



FAQ

Q: My PDH/PDL don’t match the daily chart.
A: By design this uses RTH-only highs/lows, not 24h daily bars. Adjust sessions if you want a different definition.

Q: Right-edge tags overlap or don’t sit at the far right.
A: Increase min separation / horizontal offset / vertical jitter and/or push tags farther with baseline offset. If you want markers that always hug the axis, rely on Trackprice.

Q: Can I change killzones?
A: Yes—edit the session strings in settings or request a version with user inputs for custom windows.



Disclaimer

Educational use only. This is not financial advice. Always apply your own risk management and confirmation rules.



Enjoy it? Please ⭐ the script and share screenshots using Minimal Mode + a Theme Preset that fits your style.
Nota Keluaran
AI Levels Pro — session-aware, non-repainting intraday levels.
RTH VWAP ±σ, PDH/PDL (RTH-only), ONH/ONL, IB + extensions, gap logic, alerts, full theming.

## What it plots
- PDH/PDL (RTH-only) — prior regular session high/low (no 24h mix; no repaint)
- ONH/ONL — prior overnight high/low, held through RTH
- RTH VWAP with ±σ bands — volume-weighted variance, resets at RTH open
- Initial Balance (IB) — first N minutes of RTH + 1.5× / 2.0× extensions after IB completes
- Today’s RTH Open & Prior RTH Close — gap detection + “Gap Filled” alert
- Killzone shading — NY Open (09:30–10:30 ET) & Lunch (11:15–13:30 ET)
- Values panel — each level + live distance (points & ticks)
- Right-edge level tags (anti-overlap) + native price-scale tags (trackprice)

## New in v6.6
- Custom Colors (Style & Theme)
- Save/Load Palette Codes (paste 5 hex colors; optional export in the panel)
- Minimal Mode (thinner lines; hides VWAP bands & IB extensions; on-chart tags off; price-scale tags remain)
- Theme Presets (Dark Hi-Contrast / Light Minimal / Futures Classic / Muted Dark)
- Improved anti-overlap for labels (stagger + vertical jitter + baseline offset)

## Quick start
1) Set **RTH Session** and **Overnight Session** (ET defaults: 09:30–16:00 / 18:00–09:29).
2) Choose a **Theme Preset**; enable **Minimal Mode** for screenshot-clean charts.
3) Toggle visibility for PD/ON/VWAP/IB/References/Panel.
4) Turn on **Right-Edge Labels**. If crowded, increase **min separation (ticks)**, **horizontal offset (bars)**, **vertical jitter (ticks)**, and/or **baseline offset (bars)**.

## Custom colors & palette codes
- Use Custom Colors: Settings → **Style & Theme** → toggle **Use Custom Colors**.
- Load from code: toggle **Load from Palette Code** and paste
`#388BFD,#FFAA27,#E000FF,#00C8AA,#787878`
(Order: PDH/PDL, ONH/ONL, VWAP, IB, Open/PriorClose; 6-digit hex, commas, ‘#’ optional.)
- Export: toggle **Show Palette Code in Panel** and copy the code shown.

## Alerts available
PD Touch/Break • ONH Taken • ONL Taken • VWAP Cross • VWAP Reject • IB Break Up/Down • Gap Filled
(Add alert → Condition: **AI Levels Pro** → choose event.)

## Notes
- PDH/PDL are **RTH-only** by design. If your market uses different day hours, change the session strings.
- Right-edge labels are placed at `bar_index + offset` and don’t follow extra right-margin scrolling; the **price-scale tags** do.
Nota Keluaran
AI Levels Pro — session-aware, non-repainting intraday levels.
RTH VWAP ±σ, PDH/PDL (RTH-only), ONH/ONL, IB + extensions, Open/Prior Close + Gap, optional Yesterday RTH VAH/POC/VAL, alerts, and full theming.

## What it plots
- **PDH/PDL (RTH-only)** — prior regular session high/low (no 24h mix; no repaint)
- **ONH/ONL** — prior overnight high/low, held through RTH
- **RTH VWAP** with **±σ bands** — volume-weighted variance, resets at RTH open
- **Initial Balance (IB)** — first *N* minutes of RTH + **1.5× / 2.0×** extensions after IB completes
- **Today’s RTH Open** & **Prior RTH Close** — gap detection + “Gap Filled” alert
- **Killzone shading** — NY Open (09:30–10:30 ET) & Lunch (11:15–13:30 ET)
- **Values panel** — each level + live distance (points & ticks)
- **Right-edge tags** (anti-overlap) + native price-scale tags (trackprice)

## New in v6.8
- **Yesterday RTH VAH/POC/VAL** — builds a simple *RTH-only* volume profile from chart volume and plots the prior session’s VAH / POC / VAL (row size in ticks, configurable VA%).
- **Advanced Band Colors** — set colors independently for **VWAP center** and each **±1σ / ±2σ / ±3σ** band (with optional auto-tint from ±1σ).

## Quick start
1) Set **RTH Session** and **Overnight Session** (ET defaults: 09:30–16:00 / 18:00–09:29).
2) Pick a **Theme Preset**; enable **Minimal Mode** for screenshot-clean charts.
3) Toggle visibility for PD/ON/VWAP/IB/References/Panel as needed.
4) Turn on **Right-Edge Labels**. If crowded, increase **min separation (ticks)**, **horizontal offset (bars)**, **vertical jitter (ticks)**, and/or **baseline offset (bars)**.

## Volume Profile (Yesterday RTH)
- Settings → **Volume Profile (Yesterday RTH)** → toggle **Show Yesterday RTH VAH / POC / VAL**.
- Choose **Row size (ticks)** (2–8 ticks is a good start) and **Value Area %** (default 70%).
- Uses your **RTH Session** definition. Values **appear after the next RTH close** (we freeze the profile at RTH end).
- Best on **regular candles** (1–5m).

## VWAP bands & colors
- Settings → **VWAP** → toggle **Advanced Band Colors** to color **center VWAP** and **±1/±2/±3σ** separately.
- Keep **Auto-tint** ON to shade ±2/±3 from your ±1, or set each band manually.

## Custom Colors & Palette Codes
- Settings → **Style & Theme** → **Use Custom Colors** to set PDH/PDL, ONH/ONL, VWAP (center), IB, Open/Prior Close.
- Or toggle **Load from Palette Code** and paste
`#PDH/PDL,#ONH/ONL,#VWAP,#IB,#OpenPriorClose`
Example: `#388BFD,#FFAA27,#E000FF,#00C8AA,#787878`
(6-digit hex, commas, ‘#’ optional). Enable **Show Palette Code in Panel** to export yours.

## Alerts
**PD Touch/Break · ONH Taken · ONL Taken · VWAP Cross · VWAP Reject · IB Break Up/Down · Gap Filled**
(Add alert → Condition: **AI Levels Pro** → choose event.)

## Notes
- Levels are computed in-session and **do not repaint**. PDH/PDL are **RTH-only** by design.
- Right-edge labels are placed at `bar_index + offset` and don’t follow extra right-margin scrolling; the **price-scale tags** do.
- Validate with **regular candles** when checking level values.

— Enjoy and trade safe.
Nota Keluaran
## New in v6.8.2
- Fix: resolved a rare runtime error when turning on Volume Profile mid-session (guarded arrays).
- UI: panel now shows “—” for Y-VAH/POC/VAL when VP is ON but hasn’t frozen yet (values appear after the next RTH close).

### Volume Profile (Yesterday RTH) quick start
Settings → **Volume Profile (Yesterday RTH)** → **Show** → pick **Row size (ticks)** (2–8) and **VA%** (70%).
Uses your **RTH Session**; values populate **after the next RTH close**. Best on **1–5m regular candles**.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.