OPEN-SOURCE SCRIPT
ที่อัปเดต:

TTP IMB - Unfilled Imbalances

1 056
What it draws
Unfilled imbalances — three-bar fair value gaps — from four timeframes at once (4H, 1D, 1W, 1M by default, all configurable), rendered on whatever chart timeframe you are on. Switching the chart resolution does not change the levels: a weekly gap keeps the same two prices whether you are looking at 4H or 1D.

A gap is defined by wicks across a three-bar window:

bullish — the high of the first bar is below the low of the third
bearish — the low of the first bar is above the high of the third
The box spans exactly those two extremes.

When a gap stops being drawn
Once price has overlapped 66.6% of the box's ORIGINAL height, measured from the side price enters by. A bullish gap dies when price falls that far into it from the top; a bearish gap when price rises that far from the bottom. A wick is enough by default — there is a setting to require a close instead, which leaves noticeably more zones alive.

The threshold is adjustable. 100 means only a complete traverse closes a zone, 50 is the classic midpoint rule.

Partially overlapped zones keep their full original geometry — the box does not shrink, so you can always see the imbalance as it was formed.

Fading
A zone price has already eaten at least 50% into, but which has not reached the closing threshold, is drawn faded and labelled with its fill percentage. This separates an untouched imbalance from one that has already been worked, without hiding either.

Multiplicative search band
Zones lying entirely outside a band around current price are discarded before anything else. That band is a RATIO — price/N up to price*N, N=2 by default — not a percentage.

This matters more than it sounds. A symmetric percentage band is badly lopsided, because price moves in multiples: −80% is 0.2x, a five-fold drop, practically zero, while +80% is only 1.8x, a couple of levels. Equal ratios up and down is what a log chart actually shows.

Timeframe gating
Only timeframes at or above the chart's own are computed, and only up to a ceiling of N rungs above it (2 by default). On a 4H chart that gives 4H/1D/1W and drops the monthly; on a daily chart, 1D/1W/1M. Timeframes below the chart are never drawn — they would be hairlines — and are not calculated at all.

Set the ceiling to 3 to see everything at or above the chart, or to 0 for the chart's own timeframe only.

How much is shown
Per timeframe: the N nearest unfilled zones above price and N below (3 each by default), plus every zone that currently CONTAINS price — those are the operative ones and are never rationed away.

Border thickness increases with timeframe, so the hierarchy reads at a glance.

Settings worth knowing
Filled at (%) — closing threshold, default 66.6
A wick is enough to fill — off requires a bar close beyond the threshold
Zones per side, per TF — default 3
Search range (xN) — multiplicative band, default 2
Dim a zone once filled (%) — fading threshold, default 50
Rungs above chart TF — the gating ceiling, default 2
Ignore zones thinner than (%) — optional micro-gap filter, off by default
Notes and limitations
The still-forming higher-timeframe bar cannot CREATE a zone — that would repaint intrabar — but it does count toward FILLING one, so a zone can die live as price moves into it. Everything else is closed-bar only.

Buffers fill only as far back as the chart's own loaded history reaches. On a 4H chart covering roughly two years, the monthly buffer holds about two dozen months rather than the full setting. This does not affect zones near price, which is all the script draws.

The gap scan is linear in the number of bars. The "has this gap been filled" test is answered with suffix extremes rather than a nested scan over later bars, which is what keeps four timeframes inside the execution budget instead of timing out.

This is a visualisation tool. It marks structural levels and does not generate entry or exit signals.
Release Note
Bounded zone boxes

Zones no longer stretch to the right edge of the chart indefinitely. Every box now ends on one common right edge, a set number of bars past the last bar, so zones from all timeframes line up neatly instead of running off-screen.

The left edge still sits on the bar where the gap formed, so you can see where each imbalance originated.

New settings in the Display group:
- Right edge (bars past last bar) — where every box ends. Default 10.
- Fixed box length — optional: draw every box the same length instead of starting it at the gap's origin. Off by default.
- Box length (bars back from last) — used only when Fixed box length is on. Default 30.

Detection, the fill rule, fading and filtering are unchanged.

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน