Supply & Demand Zones - Zone Forge [AFD]
Two zones on your chart. One came from a four-bar coil that price left in a single decisive candle. The other took twenty bars to go nowhere and slid out the bottom. Your indicator drew them identically.
That difference is measurable at the moment each zone forms - how tight the base was, how hard price left it - and it is measurable from the same two numbers the tool already had to compute in order to find the zone at all. Almost every zone tool computes them on the way past and throws them away.
Zone Forge keeps them. Every zone is scored on how it was constructed, and the score is painted rather than printed: a well-built zone carries more glow and deeper fill, a marginal one recedes into the background. No letter, no number, nothing to decode. The chart sorts itself.
Why it matters
A supply or demand zone is a fussy construction pretending to be a simple one. It needs a short, tight cluster of bars - the base - that price then left decisively in one direction. Both halves are measurable, and the ratio between them separates a coil that broke from a range that drifted. This describes how an area formed, and says nothing about what price does next.
At a glance
Four patterns, each switchable - rally-base-drop and drop-base-drop become supply; drop-base-rally and rally-base-rally become demand. Turn off the ones you do not trade.
A grade on every zone - built from two ratios the engine already computes, tiered Strong, Standard and Weak, and shown as vividness rather than as a label.
A one-way lifecycle - Fresh, Tested, Broken. A broken zone never returns to fresh, and a tested zone steps further back with each additional test.
Detection in one click - Scalp, Intraday or Swing set base length, tightness and departure strength together. Custom exposes all three.
Measured against your chart's own volatility - base height and departure distance are both in ATR(14) units, so one setting means the same thing on a $4 stock and a $400 one.
Nine colour themes - Signature, Neon, Muted, Mono, Terminal, Midnight, Ocean, Ember, and Paper for light charts, plus Custom. Three appearance presets over the top - Signature, Clean and Minimal - plus a Custom that leaves every control acting on its own.
Four alert conditions - new demand zone, new supply zone, zone tested, zone broken, as four separate entries in the alert dialog rather than one.
Three Data Window values for screening - distance to the nearest demand zone, distance to the nearest supply zone, and whether price is inside one.
How a zone is built
A base is a run of bars whose whole height fits inside Base tightness x ATR(14). A departure is a bar that CLOSES beyond that base by at least Departure strength x ATR(14) - the close, never the high or the low, so a spike that closes back inside draws nothing.
Both halves must be complete. A zone is created from a finished base and a finished departure, and appears on the bar that closes the departure, not before.
Two rules that change what you see:
A tight run LONGER than Base max length is rejected as a range. It is not trimmed to its last few bars and admitted anyway.
The departure is measured against the PREVIOUS bar's ATR, so the departure bar's own range cannot inflate the threshold it has to clear.
The grade, stated plainly
grade score = (departure distance / required distance) / max(base height / height limit, 0.50)
A zone that cleared the departure requirement by 3x off a base using half its allowed height scores well above one that cleared it by 1.1x off a base that used all of it. Only just qualifying on both counts scores 1.0x.
Weak, Standard and Strong are fixed thresholds on that score, and the tier is decided on the bar that creates the zone.
The score is computed once and is never recomputed. A zone already on your chart does not restyle itself later.
Grade emphasis sets how far apart the three tiers LOOK, from nearly identical to a wide visual split. It changes appearance only, never which tier a zone is in.
The tiers describe construction. They are not a ranking of what is likely to happen at a zone, and no tier is presented as the one to trade.
The lifecycle
Fresh - price has not come back yet. Brightest.
Tested - price traded into the zone and it held. The fill and glow step back, and each further test steps them back again up to a fixed limit, so an area that has been worked repeatedly recedes on its own rather than vanishing.
Broken - price closed through it. Hidden by default, because showing them roughly triples what is on the chart.
You choose what counts as each. Break rule is close-through or wick-through; Test rule is wick-touch or close-inside. Break beats test on the same bar, and the lifecycle only ever runs one way - a broken zone never becomes fresh again.
Flip broken zones, off by default, draws a fresh zone of the OPPOSITE type at the same levels when a zone breaks. The broken zone stays broken - this creates a new zone rather than reversing an old one, so nothing already on your chart changes what it claims to be. One generation only.
How it differs from a standard zone tool
The grade is a consequence of the construction, not a bolt-on - a swing-pivot band inflated by a fixed ATR width has no tightness to measure, and a fair-value gap has no base at all. Only something that finds a consolidation and THEN measures the move away from it has the two numbers to divide.
Strength is the visual language - the ranking is carried by glow and fill depth, so the chart is read at a glance instead of decoded. No letter appears on the box unless you ask for one.
The chart is kept bounded on purpose - a cap per side, a maximum age, broken zones hidden, and an overlap rule that will not admit a new zone sitting on top of a live one.
A theme system, not a colour picker - nine curated palettes, one of them built for a light chart, and three appearance presets over the top.
Nothing about the grade is hidden - the score is one division, the two thresholds it divides are the same ones detection already applied, and every constant is a named value in source you can read. A trust signal, not the pitch: what you are here for is the zones.
The visuals
Layered glow, not a flat rectangle - concentric halo boxes off a single Glow intensity control, with a floor so no layer is ever invisible. Glow spread sets how far the halo reaches.
Fill, border and edges are independent - each carries its own colour, width and style, and each can be switched off. Border off leaves the fill and the glow; fill off leaves an outline.
Emphasise nearest zone - thickens the border of the zone closest to price on each side.
50% line - the midpoint mitigation level, off by default, with its own colour and style.
Labels - Type, Type + age, Type + grade, Type + touches or Age; four positions, four sizes, a bar offset; worded Supply/Demand, the full pattern name or the trade shorthand. Every label carries a hover breakdown: pattern, span, state, age and grade.
Zone count table - a small optional panel counting what is on the chart.
Master opacity - fades every colour together in one control, without touching any individual setting.
Alerts
New demand zone
New supply zone
Zone tested
Zone broken
Create these from PulseWire's alert dialog. How often an alert re-fires while its condition holds is set in that dialog, not in the script. A running alert keeps the inputs, symbol and timeframe it was created with - recreate it after changing any of them.
How to use it
Pick a detection style first - Scalp, Intraday or Swing. It is the only setting that changes WHAT gets found; everything else changes how what was found looks.
Works best on a 5-minute chart or lower - a zone needs a completed base and a completed departure to print, and that pattern completes far more often per session on a fast chart than a slow one, so a 5-minute-or-lower timeframe gives you more zones to read.
Read the fresh zones first - they are the brightest, and they are the areas price has not returned to.
Read the grade as build quality - a Strong zone came from a tight base and a decisive departure, a Weak one only just cleared both tests. Both are drawn, because knowing which is which is the point.
Watch a zone dim - each test steps it further back. A zone tested three times looks like what it is.
Set the look once - Preset gives you the vivid default, a clean one and a minimal one in a click, or Custom to set everything yourself; Colour theme gives nine palettes; Master opacity fades the lot. Then leave it alone.
Hover anything unclear - all 63 inputs carry a tooltip, and every zone label carries a breakdown.
What it deliberately does not do
It reads the open, high, low, close and volume of the chart you have open, and nothing else. There are no request.security() calls, no other symbol, no higher-timeframe import, and no options or order-book data of any kind.
So it does not know about order flow, dealer positioning, or where anyone's orders actually are. Supply and demand here name where a price move ORIGINATED. They do not name a measured book, and the words that would imply otherwise are kept out of every string this script ships.
It draws no entries, exits, targets or arrows, and makes no accuracy, reliability, profitability, probability or future-result claim of any kind. The grade describes an area built from bars that have already printed: a construction score establishes neither future direction nor the quality of any trade. Educational chart context only - not financial advice.
Data, timeframes and what to check yourself
Zones are created from confirmed bars only - a completed base and a completed departure. Once created, a zone's geometry does not move: its top, bottom and left edge are fixed, and only its lifecycle state changes, one way, on closed bars. Confirm it with the bar-replay tool on your own symbol and timeframe before relying on it - a description of mechanism is not that check, and nothing here claims to be.
The three Data Window values read the live close - the two distances and the inside-zone flag. They create, test, break and prune nothing.
The zone count is bounded by Pine's drawing limits - the source declares budgets of 500 boxes, 500 lines and 100 labels, and every glow layer, edge line and label spends from them. Max zones per side and Max zone age are the controls that keep you inside.
Standard time-based candles - on Heikin Ashi, Renko or Range the engine measures those synthetic values rather than traded prices, so the bases it finds are not the bases on your price chart.
Base tightness is not a strictness dial - the zone count peaks in the middle of its range and falls away at both ends, which is why the range stops where it does. Loosening it past the peak draws FEWER zones, not more.
Detection needs history - ATR(14) must exist before anything can be measured against it, so the opening bars of a chart produce nothing.
Originality and credit
Supply and demand zones are old ground. What is new is that the construction is measured, and the measurement is what you see: base tightness and departure distance resolved into one score, that score frozen on the bar that creates the zone, and the ranking expressed as glow and fill depth rather than as a label to decode.
Open source under the Mozilla Public License 2.0. (c) Auction Foundry.
Indicator



