OPEN-SOURCE SCRIPT
Diupdate

Untested Levels - PD Highs, Lows & Gaps

475
Untested Levels automatically maps the session prices futures traders commonly mark by hand: previous regular-session highs and lows, current and prior overnight highs and lows, previous closes and unfilled gap levels, plus the all-time high.

The purpose is simple: spend less time redrawing levels every morning and keep important price context visible as the market develops. Each line begins where its high, low, or close was established and is labeled with both its name and exact price.

The indicator is designed around the session structure of CME equity index futures, particularly Nasdaq futures (NQ/MNQ) and S&P 500 futures (ES/MES). Its session times are fully configurable, so the same framework can be used with other futures markets whose trading sessions are defined appropriately.

WHY IT IS DIFFERENT

Many session-level tools either show only the most recent day or remove a level as soon as price reaches it. This indicator maintains a structured history and treats a level's first breach separately from its display timing.

By default, a prior level that is breached during the current trading day remains visible until the day rolls over. This preserves the line for the rest of the session, allowing you to see whether a former high or low is subsequently respected, rejected, or used as support or resistance. If you prefer immediate removal, the "Hide breached levels immediately" setting is available.

Regular-session highs and lows, overnight highs and lows, and prior closes each have their own lookback setting. You can retain more history for one class of level without overcrowding the chart with every other class.

The calculations are session-defined rather than chart-defined. They are built from the symbol's extended-hours feed, so switching the chart between Regular Trading Hours and Electronic Trading Hours does not change the underlying levels. An RTH chart can therefore remain visually clean while still displaying the overnight high and low.

LEVEL NAMES

The numbering follows trading days, not calendar dates. The overnight session belongs to the same trading day as the regular session that follows it.

YD High / YD Low
Yesterday's regular-session high and low.

PD 2 High / PD 2 Low
The regular-session high and low from two trading days ago.
PD 3, PD 4, and later numbers continue in the same way.
YD is effectively the first prior trading day, so there is no separate
"PD 1 High" or "PD 1 Low" label.

ON High / ON Low
The current trading day's overnight-session high and low.
These update while the overnight session is forming.

ETH 1 High / ETH 1 Low
The overnight high and low associated with yesterday's regular session.
ETH 1 therefore pairs with YD.

ETH 2 High / ETH 2 Low
The overnight high and low from two trading days ago.
ETH 2 pairs with PD 2, ETH 3 pairs with PD 3, and so on.

YD Close
The most recent configured session close. This level always displays when
previous-close levels are enabled.

PD 2 Close, PD 3 Close, etc.
Older configured closes that remain unfilled by a later regular session.
These levels identify still-open historical gaps within the selected
gap lookback.

ATH
The all-time high. If a displayed high is also the all-time high, its
normal label receives an ATH prefix. If the all-time high is not one of
the displayed session levels, a separate ATH line is drawn.

SESSION CALCULATIONS

Each configured trading day is divided into three parts:

Overnight session:
Trading-day start to the regular-session open.
This produces ON and ETH highs and lows.

Regular session:
Regular-session open to regular-session close.
This produces YD and PD highs and lows.

Post-close tail:
Regular-session close to the next trading-day start.
This does not create a new session high or low, but its price action can
breach an existing level.

The default times are expressed in Pacific Time:

Trading day starts: 15:00
Regular session opens: 06:30
Regular session closes: 13:15
Close candle opens: 13:55

The time zone and all session boundaries can be changed in the settings. The "Close candle" input identifies the opening time of the candle whose closing price will be stored. If that exact candle is unavailable, the script uses the last available candle before the selected time.

WHAT COUNTS AS UNTESTED

A prior regular-session high remains unbreached until later price trades above it. A prior regular-session low remains unbreached until later price trades below it. The calculation considers price action after the level's own regular session, including that day's post-close tail, later overnight sessions, and later regular sessions.

An overnight high or low is evaluated only against price action after that overnight session ends. This prevents the price action that created the level from also invalidating it.

By default, an exact touch does not count as a breach; price must trade through the level. Enable "Exact touch counts as a breach" if you want a touch to invalidate it.

YD High, YD Low, ON High, ON Low, and YD Close remain available as current reference levels even when tested. Older PD and ETH levels are filtered according to their breach status and your selected display timing.

PREVIOUS CLOSES AND GAPS

YD Close always shows when enabled. Older closes appear as PD n Close only while their gap remains unfilled.

Gap status is based on later regular-session price action. Overnight and post-close-tail activity do not fill a close gap. This keeps the gap logic aligned with the cash-session context rather than allowing overnight movement alone to remove the level.

An alert condition is included for price touching or crossing YD Close during the regular session.

ALL-TIME HIGH

The ATH calculation combines available chart history, extended-hours intraday history, and extended daily history. If the ATH matches a displayed high, that label is prefixed with ATH and emphasized. Otherwise, the indicator creates a standalone ATH level so the price remains marked even when it falls outside the selected session lookbacks.

LOOKBACKS AND DISPLAY CONTROLS

The indicator provides independent controls for:

• Regular-session high/low lookback
• Overnight high/low lookback
• Prior-close and gap lookback
• YD, PD, ON, ETH, close, ATH, and label visibility
• Immediate or end-of-day removal of breached levels
• Exact-touch breach behavior
• Session times and time zone
• Colors, line style, line width, label size, and label offset

Separating the lookbacks makes it possible to retain a broad history of untested highs and lows while using a shorter window for overnight levels or gaps.

RTH AND ETH CHART BEHAVIOR

All session values are requested from extended-hours data, so the same calculated levels appear whether the chart is displaying RTH or ETH candles.

TradingView scripts only execute when the chart receives a bar. An RTH chart therefore cannot update live while its chart session is closed. To handle this, "Roll levels at the regular session close" is enabled by default. It advances the labels and removes levels breached during the completed day on the final regular-session bar, leaving a frozen RTH chart in the correct end-of-session state. The extended-hours feed completes the normal rollover when the next chart session begins.

For live overnight development of ON High and ON Low, use an ETH chart.

HOW TO USE THE LEVELS

These lines identify historically significant prices; they do not predict which level price will visit or how price will react when it gets there. Traders may use them as context for targets, breakouts, failed breakouts, support/resistance flips, gap fills, and confluence with their own trade setups.

The retained-line behavior is especially useful after a breach: instead of losing the reference immediately, you can observe whether price returns to the level and changes its behavior around it later in the same session.

LIMITATIONS

This indicator is intended for intraday charts. Its session calculations use an extended-hours intraday feed, set to five minutes by default. Available lookback depth depends on the amount of intraday history TradingView provides for the symbol and the user's plan.

Session defaults are designed for the stated CME equity index futures workflow. Confirm and adjust the time zone, trading-day start, regular-session boundaries, and close-candle time before using the indicator on another market.

Holiday schedules, shortened sessions, missing bars, exchange data differences, and delayed feeds can affect the levels. Use standard price charts and verify the settings for the instrument being traded.

Untested Levels is a charting and market-context tool, not a trading system. It does not provide entries, exits, profit targets, or guarantees of future support or resistance.
Catatan Rilis
New setting: "Include post-close session in PD/YD levels" (off by default).

Previously, price action in the post-close tail (the window between the regular-session close and the end of the trading day, e.g. the futures settlement period) could breach a prior day's high or low, hiding the level — even though the regular session itself never tested it. This could leave a day's most important level missing from the chart.

Now:
  1. Off (default, cash-focused): PD/YD highs and lows are strictly regular-session. The post-close tail of that same day can neither set the level nor breach it, so the regular-session extreme stays marked until a later trading day actually trades through it.
  2. On (futures-friendly): PD/YD levels run from the regular open through the day end, so a new extreme printed in the post-close settlement window sets or moves the level.


In both modes, tail action still counts toward breaching older days' levels, and gap fills remain regular-session-only. No other behavior has changed.

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.