PROTECTED SOURCE SCRIPT
Futures Day Trading Key Levels by Dhawal Ranka

Hey everyone, thank you for using this script, let me know in the comments how you feel about it!
What this script does:
This indicator renders one consolidated map of intraday reference levels for futures (e.g., ES, NQ, GC, CL). It is session-aware and draws:
- Previous ETH day High/Low/Close
- Previous RTH High/Low/Close (built from your RTH session)
- Today’s developing RTH High/Low and Mid
- Overnight (ON) session High/Low
- Opening Range (first N minutes of RTH): OR High/Low
- VWAP (day-anchored) with optional ±σ bands
- Floor Pivots (PP/R1/S1/R2/S2) from prior ETH daily bar
- ADR projections (Up/Down) using a configurable lookback and anchor
- Settlement: prior official settlement and today’s projected settle (with manual override)
- Weekly/Monthly context: prior W/M High/Low/Close and current W/M Open
- Minimal right-edge text tags (instead of big boxes) that sit on the price scale line and auto-pack when levels coincide
All lines extend across the chart to make confluence obvious without clutter.
How it works (methods & calculations)
Sessions
The script exposes two user sessions and a time zone:
RTH (e.g., 09:30–16:00 America/New_York)
ON (e.g., 18:00–09:29 America/New_York)
Session membership is computed with time(timeframe, session, tz) != 0.
RTH H/L/C (prev) are aggregated intrabar: on RTH start we seed H/L; while inRTH we update; on RTH end we store the close.
Previous Day (ETH) levels
request.security(syminfo.tickerid, "D", high[1]/low[1]/close[1]) supplies PDH/PDL/PDC on the continuous ETH daily.
Opening Range
On RTH start we mark orStartTime.
While RTH is active and elapsed time < N minutes, we track the running high/low.
When elapsed ≥ N minutes, we freeze OR High/Low.
VWAP & ±σ bands (intraday)
Day-anchored VWAP uses ta.vwap(hlc3).
Bands: standard deviation of (close − vwap) from day start, accumulated inline:
stdev = sqrt( mean(dev^2) − mean(dev)^2 )
Bands = vwap ± k * stdev (user multiplier).
Floor Pivots (classic)
Using prior ETH daily H/L/C:
PP = (H + L + C) / 3
R1 = 2*PP − L, S1 = 2*PP − H
R2 = PP + (H − L), S2 = PP − (H − L).
ADR projections
Daily range series rng = request.security(..., "D", high - low).
ADR = SMA(rng, L) (default L=14).
Anchor is user-selectable: today’s open or yesterday’s close.
Projections: ADR Up = anchor + ADR/2, ADR Down = anchor − ADR/2.
Settlement
Prev Settle defaults to prior ETH daily close but can be overridden manually for markets where official settlement differs from feed close.
Today Projected Settle uses the current ETH daily close value.
Weekly / Monthly context
Prior W/M H/L/C from "W"/"M" with [1], plus current W/M Open.
Rendering & label logic (originality)
Lines are persistent: each named level owns one line object that is updated, not re-created—keeps resource use low and avoids “too many plots”.
Right-edge labels are text-only (no box) placed at x = bar_index + offset and yloc.price.
When multiple levels share (almost) the same price, labels are packed side-by-side using a small bucketing algorithm:
Prices are bucketed within ±½ tick.
Each label gets a position index inside its bucket; the final x-offset = baseOffset + index*step + priority.
Priorities nudge important tags (e.g., Settle/RTH levels) closer to the price scale so they remain readable.
Why this is published & what’s original
It’s not a simple mashup: the script’s utility is the session-aware aggregation, the OR timing logic, the intraday σ calculation around VWAP, the line-persistence manager, and the label packing with priorities that keeps the right edge readable even when many levels coincide.
The closed-source protection covers the packing/priority scheme and the persistent object management that make it practical on busy futures charts without hitting Pine limits.
How to use
Set your sessions & time zone
Choose RTH/ON session windows (the defaults match CME equity index futures) and the time zone of your charting workflow.
Toggle components
Enable only the layers you need (e.g., VWAP bands off if you want a cleaner chart).
Opening Range length (minutes) is adjustable.
Settlement
If your broker/feed’s daily close isn’t the official settlement, enter a manual settle value for the prior day.
Read the right edge
Labels sit on the price scale line. When two labels share the same price, they appear side-by-side rather than overlapping.
Timeframes & symbols
Designed for intraday futures on 1–30m. Works on other symbols/timeframes but intent is day trading.
Inputs (summary)
Sessions/TZ: RTH window, ON window, time zone
Today: RTH H/L/Mid, ON H/L, OR (minutes)
VWAP: on/off, ±σ bands, multiplier
Pivots: PP/R1/S1/R2/S2 (ETH)
ADR: lookback, anchor (open vs. prev close)
Settlement: show prev/proj, manual override
Weekly/Monthly: prior H/L/C + current open
Style: line transparency; right-edge tag size, base offset, and step; optional inline labels
Limitations & notes
“Prev Settle” equals the prior daily close unless overridden.
Session definitions matter: if your exchange hours differ, set your own RTH/ON windows.
No alerts are included to minimize plot count and keep performance high (you can add alert conditions on any level in a private copy).
Disclaimer
For educational purposes only; not financial advice. Futures trading involves significant risk.
Versioning
This script will be maintained under a single publication using Update (no minor forks). Major changes will be documented in the Change Log section of the script description.
สคริปต์ที่ได้รับการป้องกัน
สคริปต์นี้ถูกเผยแพร่เป็นแบบ closed-source อย่างไรก็ตาม คุณสามารถใช้ได้อย่างอิสระและไม่มีข้อจำกัดใดๆ – เรียนรู้เพิ่มเติมได้ที่นี่
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน
สคริปต์ที่ได้รับการป้องกัน
สคริปต์นี้ถูกเผยแพร่เป็นแบบ closed-source อย่างไรก็ตาม คุณสามารถใช้ได้อย่างอิสระและไม่มีข้อจำกัดใดๆ – เรียนรู้เพิ่มเติมได้ที่นี่
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน