OPEN-SOURCE SCRIPT
Aktualisiert

Balanced Price Range (M1D)

796
Balanced Price Range
Marks one thing and refuses to mark anything else: the band of untraded price left where two opposing fair value gaps overlap, when price displaced straight back through the first gap without ever testing it. If the gap was tested first, no zone is drawn — that is an inversion, and it is a different event.

Most tools that draw a balanced price range take any bullish gap and any bearish gap, intersect them, and paint the overlap. That also fires on inversions, because an inverted gap and a fresh opposing gap produce the same geometry. This one starts from what happened at the first gap and works forward, so the two are never confused.

What separates a BPR from an inversion

A fair value gap is read over three candles and has to clear a minimum size in ticks to be watched at all. Once it is being watched, the first candle to reach its consequent encroachment decides everything, and there are only three outcomes.

The candle reaches the midpoint and closes on the respecting side of it, or closes inside the gap: the gap has been tested. It held, or price accepted inside it, and either way something happened there. It is dropped from this tool for good and can never produce a zone.

The candle reaches the midpoint and, on that same candle, closes its body clean past the far edge: no test. Nothing ever held inside it. The gap was transited in one move, and it stays in play.

The candle trades into the gap but never reaches the midpoint, then closes back outside: a probe. Nothing was proven at the midpoint, so the gap stays in play — but the wick counts, and the section on the drawn zone explains what it does.

That first distinction is the whole indicator. A tested gap that later fails is an inversion; an untested gap that is displaced straight through is what this draws.

The pivot is the window

Two opposing gaps that merely overlap are not a balanced price range. The formation is a tight swing — an inverted V or U for a bearish zone, a V or U for a bullish one — and the displacement back begins as the swing completes.

So a pivot has to sit between the gap forming and the gap being broken, and the break has to follow that pivot closely. Both are settings: the pivot length, where three candles give the sharp V and five the rounded U, and the number of bars the close-through may lag the pivot. A gap that drifts sideways for a dozen bars before finally reversing has a pivot in it somewhere too, and it is not this formation.

There is no separate shape filter, and that is deliberate rather than an omission. A fair value gap is by definition a leg that moved faster than two-sided trade could occur, so two opposing gaps with a pivot between them and no test in between already describe the V. Adding a shape test on top of that would reject valid formations without catching anything the existing conditions miss.

The same fact explains the tool's behaviour: these are uncommon on high timeframes and get more frequent as you drop down, because the speed requirement is harder to satisfy the more time a candle covers.

The zone is the untraded air, not the intersection

The overlap of the two gaps is only the candidate band. What gets drawn is the part of it with no wick lying in it.

If a wick from the bars between the two gaps reaches into the candidate band, that part has been traded and is removed, and the wick's own extreme becomes the edge of the zone. A wick taking a third of the band leaves two thirds drawn. A wick clean through it leaves nothing, and no zone appears.

Only the bars strictly between the first gap completing and the candle that broke it can trim. The breaking candle transits the whole band by definition and the second gap's own candles are the displacement, so counting either would erase every zone.

The box still starts at the candle that formed the first gap, so it stays attached to its origin rather than floating in mid-chart at the wick that trimmed it, and it runs to the live candle the way a breaker or an inversion does. A minimum size in ticks applies after the trim, so a band cut down to almost nothing does not paint.

Polarity follows the newer gap. The most recent displacement is the one describing how the market is currently delivering, so a bullish gap broken downward produces a bearish zone, and the reverse for a bullish one.

Midpoint and labels

Each zone can carry its consequent encroachment — the midpoint of the drawn band, taken after the trim rather than from the raw overlap. A range has an equilibrium; a price delivery array has a consequent encroachment, and they are not the same object.

Names sit beside the box on its centre line, just past the right edge, so a name stays readable when its zone is only a few pixels tall and never crosses the midpoint line.

The two parent gaps can be shown faintly behind the zone. It is off by default: the trimmed band is the point of the tool, and drawing both parents puts back the clutter it exists to remove.

Invalidation

A zone is spent when a candle body closes clean beyond its far edge against its direction. On the default setting it is removed, the same rule this stack applies to any spent inventory. It can instead be faded and kept, which holds the record of where delivery already happened.

Live zones are capped per side, oldest removed first, so a long session cannot fill the chart.

The console

A small table, verdict first: whether there is support, resistance, both or nothing live. Under it, the count on each side, and a respected count.

Respected means price returned into the zone and has not closed through it. It is counted only across what is currently drawn, so the number always describes the boxes in front of you rather than a hidden history, and an invalidated zone leaves the count together with its box. A watching row shows how many untested gaps are still able to become a zone.

Every row carries its rule in the cell tooltip.

Alerts

Four. Bullish zone formed, bearish zone formed, and first touch on each side. The formation alerts fire on the close that completes the second gap; the touch alerts fire the first time price returns into a drawn zone.

Method and repainting

Everything is read from the chart timeframe. There are no higher-timeframe requests anywhere in the script, so there is no lookahead to configure wrongly and no future data to leak.

Every detection is gated to a confirmed bar close. The test call, the break, the second gap and the invalidation are all judged on closed candles, so nothing appears mid-bar and then withdraws.

One characteristic is inherent to pivots and worth stating plainly rather than leaving to be discovered: a swing is only confirmed once the bars to its right have printed. On the three-candle setting that is one bar, on five it is two. A zone therefore confirms a bar or two after the move that created it. That is lag, not repainting — nothing moves once drawn.

Zones and midpoint lines extend rightward to the current bar while they are live. That is the box tracking the present, not its history changing.

What it will not do

It places no entries, exits, stops or targets, and it does not size a position. It draws no bias, no trend and no projection.

It does not read structure beyond the pivots it uses, and it does not label market phases. Whether a drawn zone is worth trading is a judgement about context this script does not have — the session, the higher-timeframe draw, and what the day has already done.

A gap that gets tested draws nothing. Two opposing gaps overlapping without a pivot between them draw nothing. A candidate band that a wick has already run through draws nothing. Only the finished sequence produces a zone, so an empty chart through a slow session is the tool working rather than failing.

Settings

Pivot length; minimum parent gap in ticks; minimum zone size after the wick trim; maximum bars from the pivot to the close-through; maximum bars from the break to the opposing gap; the per-side cap on live zones; behaviour on invalidation, remove or fade and keep; the consequent encroachment midline; the parent gaps behind the zone; how far right the drawings extend past the live candle; the console; and label text size.

Disclaimer

This is a decision-support tool for discretionary ICT trading. It is not financial advice, and no market's past behaviour is indicative of future results.
Versionshinweise
Source Code Correction

Nothing else.

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.