OPEN-SOURCE SCRIPT
Key Levels + Close Confirmation [ThetaLoop]

Purpose
Plots the reference levels intraday traders watch most and tells you, for each of them, whether it has been broken on a closing basis or only probed by a wick.
Levels
- PDH / PDL / PDC: previous day high, low, close
- PWH / PWL: previous week high, low
- W-Open / M-Open: open of the current week and month
- ORH / ORL: opening range high and low (first N minutes of the regular session, default 30). Drawn once the range is complete.
- PMH / PML: pre-market high and low. Drawn once the pre-market has ended. Requires extended hours on the chart.
All higher-timeframe levels come from completed periods. Nothing repaints. On extended-hours charts they roll over at the start of the pre-market, so PDH / PDL / PDC already refer to the last completed session before the opening bell, not to the day before it.
Close confirmation
A level counts as broken only when a candle of the confirmation timeframe closes beyond it. Default: 60 minutes. Set it to D if only daily closes count for you.
- ▲ marker: close above the level confirmed
- ▼ marker: close below the level confirmed
Markers are small triangles in the level's colour, sitting right on the level line. Hover for the details, or switch to text labels if you prefer the names on the chart. The marker prints on the first chart bar after the confirming candle has closed.
Two filters keep busy sessions readable, both on by default:
- Regular session only: pre-market and after-hours candles do not count. A level lost in the pre-market is confirmed by the first regular-session close, measured against the last regular-session close before it. With a daily or higher confirmation timeframe this filter has no effect.
- First event only: one ▲ and one ▼ per level and session, with one alert each. When price chops around a level for hours, you see two markers instead of a dozen.
Why it matters: wicks through a level are routine, especially around the open and on headlines. A break that cannot hold a close is often a liquidity grab, not a breakout. Separating the two is the point of this script.
Wick probes
- Small circle above the bar: price pierced a level from below and closed back under it (rejected)
- Small circle below the bar: price pierced a level from above and closed back over it (held)
Probes follow the same two filters: regular session only, and the first probe per level and direction in a session.
Status table
One row per active level:
- price of the level
- distance from current price in percent
- side of the last confirmed close (above / below)
- "probed" if a wick probe occurred in the current session
Relative volume
- Intraday: time-of-day RVOL. Cumulative volume of the current session up to this bar, divided by the average cumulative volume at the same bar of the previous N sessions (default 10). 1.5x at 10:15 means 50% more volume than usual by 10:15, which is far more useful than comparing a single bar with a 20-bar average.
- Daily and above: volume divided by its 20-bar average.
- Colors: orange at 2.0x or more, green at 1.2x or more, grey below 0.8x.
Alerts
Condition "Any alert() function call". One alert per close-confirmed break, with level name, price and confirmation timeframe in the message.
Notes
- Which levels appear depends on the chart timeframe: previous-day levels up to the daily chart, week/month levels below the weekly chart, opening range and pre-market levels on intraday charts only.
- A confirmation timeframe below the chart timeframe falls back to the chart timeframe.
- Time-of-day RVOL needs at least one previous session on the chart. Keep the extended-hours setting constant, otherwise bar positions inside the session do not line up. Shortened sessions are compared against full-session averages at the same bar position.
- Every level can be switched off individually.
Plots the reference levels intraday traders watch most and tells you, for each of them, whether it has been broken on a closing basis or only probed by a wick.
Levels
- PDH / PDL / PDC: previous day high, low, close
- PWH / PWL: previous week high, low
- W-Open / M-Open: open of the current week and month
- ORH / ORL: opening range high and low (first N minutes of the regular session, default 30). Drawn once the range is complete.
- PMH / PML: pre-market high and low. Drawn once the pre-market has ended. Requires extended hours on the chart.
All higher-timeframe levels come from completed periods. Nothing repaints. On extended-hours charts they roll over at the start of the pre-market, so PDH / PDL / PDC already refer to the last completed session before the opening bell, not to the day before it.
Close confirmation
A level counts as broken only when a candle of the confirmation timeframe closes beyond it. Default: 60 minutes. Set it to D if only daily closes count for you.
- ▲ marker: close above the level confirmed
- ▼ marker: close below the level confirmed
Markers are small triangles in the level's colour, sitting right on the level line. Hover for the details, or switch to text labels if you prefer the names on the chart. The marker prints on the first chart bar after the confirming candle has closed.
Two filters keep busy sessions readable, both on by default:
- Regular session only: pre-market and after-hours candles do not count. A level lost in the pre-market is confirmed by the first regular-session close, measured against the last regular-session close before it. With a daily or higher confirmation timeframe this filter has no effect.
- First event only: one ▲ and one ▼ per level and session, with one alert each. When price chops around a level for hours, you see two markers instead of a dozen.
Why it matters: wicks through a level are routine, especially around the open and on headlines. A break that cannot hold a close is often a liquidity grab, not a breakout. Separating the two is the point of this script.
Wick probes
- Small circle above the bar: price pierced a level from below and closed back under it (rejected)
- Small circle below the bar: price pierced a level from above and closed back over it (held)
Probes follow the same two filters: regular session only, and the first probe per level and direction in a session.
Status table
One row per active level:
- price of the level
- distance from current price in percent
- side of the last confirmed close (above / below)
- "probed" if a wick probe occurred in the current session
Relative volume
- Intraday: time-of-day RVOL. Cumulative volume of the current session up to this bar, divided by the average cumulative volume at the same bar of the previous N sessions (default 10). 1.5x at 10:15 means 50% more volume than usual by 10:15, which is far more useful than comparing a single bar with a 20-bar average.
- Daily and above: volume divided by its 20-bar average.
- Colors: orange at 2.0x or more, green at 1.2x or more, grey below 0.8x.
Alerts
Condition "Any alert() function call". One alert per close-confirmed break, with level name, price and confirmation timeframe in the message.
Notes
- Which levels appear depends on the chart timeframe: previous-day levels up to the daily chart, week/month levels below the weekly chart, opening range and pre-market levels on intraday charts only.
- A confirmation timeframe below the chart timeframe falls back to the chart timeframe.
- Time-of-day RVOL needs at least one previous session on the chart. Keep the extended-hours setting constant, otherwise bar positions inside the session do not line up. Shortened sessions are compared against full-session averages at the same bar position.
- Every level can be switched off individually.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
ThetaLoop | Algorithmic Options Research
🔍 Free CSP Score for any ticker — X-Ray Scanner:
thetaloop.app/xray
(Not financial advice)
🔍 Free CSP Score for any ticker — X-Ray Scanner:
thetaloop.app/xray
(Not financial advice)
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
ThetaLoop | Algorithmic Options Research
🔍 Free CSP Score for any ticker — X-Ray Scanner:
thetaloop.app/xray
(Not financial advice)
🔍 Free CSP Score for any ticker — X-Ray Scanner:
thetaloop.app/xray
(Not financial advice)
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.