PROTECTED SOURCE SCRIPT

Base candle box

71
Title
Session Candle Box (Customizable) — Pick Any Candle, Any Timeframe, Custom Length

Summary
Draw a fully customizable box from the exact high/low of a specific candle you choose (e.g., the 09:30 5-minute open) and project it for a user-defined duration measured either in source-timeframe candles or by time. The tool is multi-timeframe aware, time zone safe, session-aware, and designed to avoid repainting.

What it does

Targets a specific candle and builds a box using that candle’s high as the top and its low as the bottom.

Lets you select which timeframe the “source candle” belongs to (e.g., define the 09:30 candle on a 5m source while viewing a different chart timeframe).

Offers two ways to pick the candle: by exact session time (HH:MM:SS) or by index-from-session-open (0 = first bar of the session).

Extends the box to the right for a duration defined either by a number of source-timeframe candles (“Candles” mode) or by a time span (“Time” mode).

Keeps drawing stable and non-repainting by anchoring to the confirmed source candle’s timestamp and using time-based coordinates (so no 500-bars-into-the-future errors).

Provides extensive style controls (fill, border, midline, label) and session reset behavior (new box each session/day if desired).

Typical use cases

Opening Range tools (e.g., the 09:30 5-minute candle on equities).

Session kick-off levels for FX/indices (e.g., London or NY open bar on a chosen TF).

“Key event” candles (e.g., first bar after a scheduled release) with a controlled right projection measured in source candles.

Key features

Candle source selection: Choose the timeframe on which the defining candle lives (e.g., 5m, 15m, etc.).

Precise candle targeting: Match by exact session time (HH:MM:SS) or by bar index from session open.

Length modes:

Candles: End after N candles on the source timeframe (robust across mismatched chart TFs).

Time: End after a set duration (e.g., 60 minutes, 240 minutes).

Session-aware: Optionally reset each session/day and lock to only the first qualifying candle in that session.

Time zone safe: Uses the symbol’s exchange time zone by default, with an option to override to any valid IANA/UTC string.

Non-repainting logic: The selected candle is locked on confirmation; the box updates only its right edge according to your length mode and extend setting.

Visual customization:

Fill and border color, width, and style (solid/dashed/dotted).

Optional midline at the box midpoint with independent style.

Optional label placed at the box start.

Extend left and/or keep right edge live.

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.