OPEN-SOURCE SCRIPT

Time-at-Price S/R Pockets v11

243
TIME-AT-PRICE S/R POCKETS

WHAT IT IS

Most profiles answer "where did the business get done?" This tool starts from a different question: where has price been ACCEPTED? Time-at-price measures acceptance; volume-at-price measures participation. The two often disagree, and the disagreements are informative. This script maps acceptance into support/resistance pockets, tracks how value migrates, and runs a self-scoring projection whose structural inputs are chosen by walk-forward evidence rather than by opinion.

Everything here is descriptive and backward-looking. The projection is a model of where current forces point, not a forecast — and the script continuously publishes its own hit rate so you can see exactly how much it deserves to be trusted on your symbol.

THE POCKETS

A rolling window (tuned per timeframe by preset) is binned into price rows. Each bar adds weight to every row it touched, with a recency decay (half-life plus floor) so old structure fades without vanishing. Strength = a row's weight relative to the strongest row. Contiguous strong rows become pockets, drawn to the right of price:

- Length is proportional to strength.
- Colour is the bar-win bias inside the zone: green shades where buyers won more bars, red where sellers did, grey when balanced.
- A gold border marks pockets being tested within the recent heat window.
- Declutter: only the N strongest pockets (plus the one at price) get full labels; the rest carry hover dots with the same detail.
- A dotted line marks the Point of Control — the single most-accepted price in the window.
- A higher-timeframe rail on the far right shows the same construction one frame up (D charts get W, 1H gets D, etc.) as slim context bands.

VALUE MIGRATION

The rolling profile says where value sits; the trail says which way it is moving. A stepped PoC trail is recomputed with the same construction as the display profile, so its right-hand end lands exactly on the PoC line. Around it: a shaded value-area band (70% of the distribution by default), a drift readout in ATR units (value migrating up / down / balanced — comparable across instruments), and an overlap metric versus N bars ago (overlapping value areas = balance; stepping areas = trending).

THE PROJECTION (A MODEL, NOT A FORECAST)

A deterministic path: linear-regression drift, fading each bar, plus reversion toward the PoC, plus drag from any zone the path passes through, wrapped in an ATR*sqrt(t) volatility cone. It can terminate at the first strong zone it enters — forces point INTO structure, so projecting through it would overclaim. The reversion and fade coefficients are derived from the instrument itself (distance persistence and return autocorrelation), with manual overrides.

A tug-of-war readout decomposes the next step into momentum vs structure, with direction and ratio.

SELF-SCORING AND DRAG ARBITRATION

Three strength fields are built in one pass: Time, Volume, and Composite sqrt(time*volume). Every bar, three parallel projections — one per field, each reverting to its own PoC — are scored walk-forward against the then-unseen future: directional hit rate, and error versus a flat baseline ("predict no change"). The drag source can be fixed manually, or set to Auto: a field becomes eligible after a minimum number of scored forecasts, ranking is by error-vs-flat with hit rate breaking ties, and an incumbent is only dethroned when a challenger beats it by a margin, to stop flapping.

Read the scoreboard honestly. Forecasts are scored every bar over an N-bar horizon, so adjacent forecasts share outcome bars — the effective independent sample is roughly n divided by the horizon. Ratios near 1.0x mean no demonstrated edge, and the script will say so rather than hide it. The champion's own score is a clean walk-forward tally, but champion SWITCHING is greedy, so it is not an out-of-sample estimate of the switching policy.

INTRABAR VOLUME (EXPERIMENTAL)

Optionally, the volume fields are rebuilt from lower-timeframe data: each intrabar's volume is allocated to the bin containing its close, instead of smearing a chart bar's volume across its full high-low range. The lower timeframe is auto-selected to fit TradingView's intrabar budget (manual override available), and the HUD reports the chosen timeframe, data coverage, and any capping. The time field deliberately stays on chart-bar construction, so the scoreboards act as a controlled test of whether sharper volume allocation actually improves the projection on your instrument.

SETTINGS

The Auto preset reads your chart timeframe and applies tuned defaults for Weekly / Daily / 1-Hour / 15-Min; Manual exposes every knob. If TradingView reports the script is slow, raise the recompute stride or lower the scoring window.

LIMITATIONS, STATED PLAINLY

- Boxes, labels and lines redraw on the latest bar — standard for rolling profiles. Nothing uses future data; all scoring is confirmed-bar only.
- Without volume data the script degrades gracefully to time-only mode.
- Pockets are context, not signals. There are no alerts and no entries. If the scoreboard says the projection does not beat a flat line on your symbol, believe it.

Built from scratch; no reused open-source code. A companion script surfacing the time-vs-volume divergences directly (auction quadrants: VALUE / SOFT / EVENT zones, absorption flags, dual PoC trails) will follow.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.