Picture of the author

TradingView-RU

06/23 06:00

Large Lot Reverse Engineer [JOAT]

LARGE LOT REVERSE ENGINEER

A regression-driven block-trade detector that infers the implied size of an off-tape institutional order from the residual between price movement and volume — and turns that residual into an estimated lot count. The premise is straightforward: when a single large order moves price meaningfully more than the visible volume would justify, the gap is the size of the hidden order that absorbed the move. Large Lot Reverse Engineer models that relationship, flags the outliers, and estimates the size.



The core idea — what price movement is "worth"

In normal conditions there is a stable statistical relationship between volume and the magnitude of a bar's return. A rolling regression over a configurable window (default 60 bars) estimates expected volume as a function of return — i.e., for the move you just saw, how much volume should there have been?

The residual is the difference between actual and expected volume, Z-normalised by its own rolling stdev. Two signs of residual matter:


Implied block (residual Z ≥ +threshold) — more volume traded than the price move warrants. Someone large was on the passive side absorbing aggression. The direction of the bar tells you which side.
Thin market (residual Z ≤ −threshold) — price moved on suspiciously low volume. Liquidity was missing; the move was a low-conviction air-pocket.


Both reads are institutionally interesting. The first identifies absorbed-aggression — the textbook signature of an institutional block trade. The second identifies regimes where price prints are unreliable.

R² reliability gate

A regression is only meaningful when the underlying relationship is actually there. The script computes the rolling R² of the model and exposes a configurable minimum (default 0.10). When R² falls below the gate the model is considered unreliable; the dashboard cell turns warning-coloured and the script tags any signals fired in that regime as low-confidence. This is the difference between a real residual reading and a noise residual — a professional read forbids the same.

Significant block sizing

Three thresholds are stacked:


Implied Block Sigma (+) (default 2.0σ) — baseline implied-block trigger.
Thin Market Sigma (−) (default 2.0σ) — baseline thin-market trigger.
Significant Block Sigma (default 3.0σ) — above this the bar is rendered with a polygon glyph and gets an estimated lot-size badge . Empirical scaler converts residual-volume into a lot count.


The size unit is configurable: Shares/Coins for spot instruments, Notional USD for size in dollars (using a configurable price proxy), or Auto which picks based on instrument. The scaler is exposed because no single conversion factor is universally correct — calibrate to your instrument's typical notional.

Cluster detection

When N blocks fire inside a rolling window (configurable, default 3 in 5 bars) the Block Cluster alert fires. Cluster signals are the strongest read this script produces — they indicate sustained off-tape activity, not a single statistical outlier.

Visual system


Residual Z histogram — bars coloured bull/bear by direction, magnitude by residual.
Threshold lines at ±2 and ±3 with on/off toggle.
Zero line and significant-block polygon glyphs.
Thin-market dots in the muted palette.
Background recency fade — fresh blocks tint the background and decay to transparent over a configurable number of bars.
Cumulative implied delta (optional) — running sum of implied-block directional contributions, useful for reading sustained institutional bias.


A locked Carbon palette (neon green / neon red / white midline on carbon black) gives the pane an institutional terminal feel.



Dashboard

Monospaced table, positionable to any of nine corners, with a compact mode and optional legend footer. Surfaces:


Current residual Z value and sign.
R² value with reliability colour-coding (green / amber / red).
Last significant block direction with estimated lot size.
Block count and thin-market count in the recent window.
Cluster status with bars-since-last-cluster.
Cumulative implied delta (when enabled).


Alerts

Four alert conditions, each independently controllable:


Implied Buy Block (positive residual + up bar)
Implied Sell Block (positive residual + down bar)
Thin Market Event (negative residual)
Block Cluster (N-in-window)


How to read it

Three reads, in order of conviction:


Block Cluster + high R² — the highest-conviction read. Multiple statistically-significant blocks inside a window, with the underlying model reliable. Institutional flow is actively moving size.
Significant block (3σ+) at a known level — a single large polygon glyph at a key support/resistance is a textbook absorbed-print read. The lot-size badge gives you a magnitude proxy you can compare across bars.
Thin market warning — when the residual goes deeply negative, treat any move you see with extreme caution; the tape is hollow. Often precedes either a violent move once real flow returns or a fade back to fair value.


Suggested settings

Defaults (60-bar window, R² ≥ 0.10, ±2σ block, +3σ significant) are tuned for 5m–1H on liquid futures, FX, and large-cap equity. For lower timeframes drop the window to 30 and raise the sigma thresholds to 2.5σ / 3.5σ to filter noise. For daily and above, widen the window to 100+ and consider log returns for instruments with large price scales.

Originality

The implementation — the rolling return-vs-volume regression with R² gate, the residual-Z classifier with bidirectional thresholds, the empirical lot-size scaler with auto/notional unit switching, the polygon-glyph significant-block render, the thin-market dot variant, the N-in-window cluster trigger, the recency-fade background, and the cumulative implied delta — is JOAT-original. No third-party code reused. The "volume that should have been" inference pattern is well-known to institutional desks; the implementation here is purpose-built for chart-based bar data.

Limitations

Implied block size is an inference from residual statistics, not a direct read of off-tape trades. Pine cannot see actual block prints that occur away from the lit market; what the script flags is the visible footprint those prints leave behind. The lot-size badge depends on the empirical scaler, which must be calibrated per instrument — the default 1.0× is generic. The R² gate is the most important reliability filter; when R² is low, no signal in the model should be considered reliable, by construction.



-made with passion by jackofalltrades
SukaBagikan

Semua Komentar0TerkiniHangat

avatar
TerkiniHangat