OPEN-SOURCE SCRIPT
已更新

Session block profile

366
Every part of the trading day has a personality. See yours in one table.

Description

Splits the trading session into fixed-length blocks and, for each block, keeps a rolling history of what that part of the day has done over the last N sessions. Three descriptive measures per block: how large its range tends to be relative to the average block, how much volume it tends to carry relative to the average block, and how directional it tends to be, measured as the average of the block's body over its range.

How it calculates

Each bar is assigned to a block from its minute of the day in the chosen time zone. A block's high, low, open, close, and volume accumulate on confirmed bars. When the first confirmed bar of a different block or a different day arrives, the completed block is written into its rolling history and that block's means are recomputed once. Range and volume indices are each block's mean divided by the average across all blocks with enough history, so 1.00 is an average block. Body ratio is the mean of |close - open| divided by (high - low) for the block, so 0 is a doji and 1 is a full-body bar.

How to read it

Range and volume shade toward green as they rise above the average block. Body shades toward amber as blocks become more directional. The current block's label is amber. Alternate blocks can be shaded on the chart so the grid is visible against price. This is a description of what each part of the day has tended to do. It is not a forecast.

Repainting

Closed blocks do not repaint. History is written only when a block completes. The current block is marked but its partial values are not shown as a statistic.

Originality and attribution

Session statistics by time of day are a familiar idea. What is original here is the block-keyed rolling history with cached per-block means, the three-measure normalization against the session's own average block, and the heat-table presentation. This is not derived from and does not reuse code from any existing published script.

Honest limitations

The session must start and end on the same calendar day in the chosen time zone. Sessions that cross midnight are not supported.
A partial first day in chart history contributes a partial block. The minimum-sessions setting exists to absorb that.
Half days, holidays, and early closes pollute a block's history for as many sessions as the lookback.
Range and volume are relative to the average block within this session window, so the indices are only comparable inside one configuration.
Body ratio is not a trend measure. A block can have a high body ratio and still be a small, meaningless move.
Nothing here is a signal. A high-range block is not a direction.
發行說明
Substantial rewrite. Readings will differ from the previous version.

What changed in the calculation

Sessions are now committed atomically. A session enters history only after every expected block and every expected bar within it is present, so partial history days, early closes, half days, and data gaps are excluded whole rather than quietly distorting individual rows. The count of excluded sessions is reported in the header.
Range and volume are normalized inside each completed session before they enter history. Every session now carries equal statistical weight, so an unusually volatile or high-volume day can no longer dominate the profile merely because its raw scale was larger. This is the change most likely to move your numbers.
The default central estimate is the median with an interquartile range. Mean is available as an explicit option.
Volume completeness is tracked separately from bar completeness, so a symbol with partial volume data reports its range profile and marks volume as unavailable rather than reporting a misleading number.

What was added

Raw range and raw volume medians alongside the normalized intensities, in the cell tooltips, so the relative number and the absolute number are both visible.
Efficiency: the absolute close-to-open distance over the block's range. A block can have a large range and a small body, which is wide chop, or a modest range and a large body, which is a small clean move. Range alone does not distinguish those.
Direction: the signed version of the same quantity, from -1 to +1.
P(up): the share of non-flat completed blocks that closed above their open, with a 95% Wilson interval.
An optional marker and alert when a block whose historical range and volume intensities both exceed a configured threshold begins. It is a time-of-day notification, not a directional call.
Live partial-block range, volume, and bar count in the cell tooltips.
Table text size and position inputs.

On colour

Emphasis marks a departure in either direction. The sign lives in the number, never in the colour alone. P(up) is emphasized when its interval excludes an even split, whichever side it falls on.

Requirements, which are stricter than before

Intraday, whole-minute chart timeframes only. The chart timeframe must divide the session start, the session length, and the block length exactly, and the block length must divide the session exactly. For a 09:30 to 16:00 session with 30-minute blocks that is 1, 2, 3, 5, 6, 10, 15, or 30 minutes.

Note that a 09:30 to 16:00 session is 390 minutes, and 60 does not divide 390, so 60-minute blocks are refused on a standard US equity session. Valid block lengths there include 5, 10, 15, 30, and 65. Configurations producing more than 40 blocks are also refused. Every refusal states what to change.

Unchanged, and still the point: this is a descriptive clock-time profile. It is not a signal or a forecast, and a high-range block is not a direction

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。