OPEN-SOURCE SCRIPT
تم تحديثه

PDH PDL + Key Levels

537
# PDH PDL + Key Levels

A single indicator for the horizontal levels that actually matter intraday: previous day, week and month extremes, custom session highs and lows, and the New York open — with lines that stop where price consumed them instead of running across the whole chart.

## What it plots

**Previous period extremes**
PDH / PDL, PWH / PWL, PMH / PML. Each line is anchored at the bar that printed the extreme and extends to the right, so you see both where the level was made and how far it has travelled untouched.

**Session highs and lows**
Three independent, fully configurable sessions (defaults: New York, Asia, London). While a session is open its high and low develop live and are never cut. Once the session closes they freeze and become eligible for consumption like any other level.

**NY Open**
A fixed reference at 09:30 America/New_York. The price used is the close of the 09:29 one-minute candle, requested from a 1-minute context with lookahead off — it appears only once that candle has closed, so the level never repaints. The timezone is IANA, so daylight saving is handled automatically. Intraday timeframes only.

## Cut when consumed

The core behaviour. A level stops being drawn the moment price reaches it:

- A high acts as resistance and is consumed by any candle whose **high** reaches it — gaps up included.
- A low acts as support and is consumed by any candle whose **low** reaches it — gaps down included.
- The NY Open can be approached from either side, so it is consumed by a candle that straddles it or by a gap that jumps clean through it.

The result is a chart where a long horizontal line means genuinely untested, and a short stub means the level was taken out early. Consumption checks only start after the level's own period begins, so a fresh PDH is never cut by the day that created it. Turn the behaviour off and every line simply extends to the current bar.

## Coincident levels merge

When two or more levels land on the same price — within one tick — they fold into a single line with a combined label, for example `PDH + NY-H`. Hierarchy runs monthly, weekly, daily, sessions, NY open, and the surviving line keeps the **latest** endpoint of the group, so a level that is still alive never inherits an older level's cut.

## Settings

**General** — toggle cut-on-touch, toggle merging, show or hide all labels, label size.

**Line style** — style and width for the previous-period extremes.

**Colors** — separate colors for highs and lows, plus a master override that paints everything one color without erasing your palette underneath. Switch it off and your own colors come straight back.

**Levels** — individual toggles for PDH, PDL, PWH, PWL, PMH, PML. Monthly extremes are off by default.

**NY Open** — enable, label text, color, style, width. The time is not configurable by design.

**Session 1 / 2 / 3** — enable, label prefix, hours, timezone, color, style, width. Timezones accept GMT notation (`GMT-5`) or an IANA name (`America/New_York`); IANA is recommended because it survives daylight saving.

## How to use it

Mark your session before the open: untouched PDH and PDL are the most obvious draws on liquidity for the day, and the ones still extended after several sessions tend to be the ones price eventually goes to fetch. Session extremes give you the boundaries of the Asian and London ranges going into New York. The NY Open acts as the intraday mean many algorithmic systems reference — price reclaiming or rejecting it in the first hour is frequently the cleanest read of the session's direction.

Because a consumed level disappears, what remains on screen is the set of unresolved objectives, which keeps the chart readable without manual cleanup.

## Notes and limitations

- Levels are redrawn on the last bar only. The indicator shows the current state of the chart, not a historical record of every level that ever existed. It is a live map, not a backtest.
- The NY Open needs a 09:29 one-minute candle to exist. On a chart restricted to regular trading hours that begins at 09:30, that candle is absent and the level will not print. Use an extended-hours chart for futures.
- Sessions are evaluated on the chart's own bars, so a window narrower than your timeframe may never trigger. Keep session ranges wider than a single bar.
- Line and label counts are capped at 500 each, which is well above anything this indicator produces.

No alerts, no signals, no repainting. Just the levels.
ملاحظات الأخبار
Added an independent cut toggle for the NY Open.

The level now has its own Cut on first touch checkbox in the NY Open group, separate from the global cut setting. Turn it off and the line runs uncut all the way to the current bar even when the global cut is on. Turn it on and it cuts at the first touch even when the global cut is off.

The touch logic is unchanged: the level is consumed by a candle that straddles it, or by a gap that jumps clean through it in either direction.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.