OPEN-SOURCE SCRIPT
OB + SD MTF Overlap

# OB + SD MTF Overlap
## Overview
Most order block and supply/demand tools draw zones for a single timeframe. That
forces you to flip between charts to know whether the level you are looking at also
matters on the higher timeframes — and by the time you flip back, the reaction is over.
This script merges **two different zone engines** — Volumized Order Blocks and
Supply & Demand — and renders both across **up to six timeframes at once** on a single
chart. Instead of a wall of boxes, it encodes the important part as **color intensity**:
the more confluence at a price level, and the higher the timeframe it comes from, the
more opaque the zone. One glance tells you which levels are worth your attention.
## How the zones are detected
The script runs two independent detection engines. They never mix with each other:
an order block is only ever merged with another order block of the same direction, and
a demand zone only with another demand zone.
**Order Blocks (structure based).** A swing high/low is confirmed with a configurable
swing length (default 10). When a close breaks that swing, the script walks back through
the impulse to find the origin candle — the lowest low before a bullish break, the
highest high before a bearish one — and marks that candle's range as the zone. Zones
larger than 3.5×ATR(10) are discarded as noise. Each block also stores the volume of the
three candles that produced the break, split into buy-side and sell-side, and displays
the total plus an imbalance percentage (for example `24.657M (32%)`). A low percentage
means the break was one-sided; a high percentage means it was contested.
**Supply & Demand (momentum based).** When four consecutive candles print bodies larger
than half the 20-period average body in the same direction, the script marks the base
candle that preceded the burst. These zones are clamped to 1.5×ATR(20) so a single wide
candle cannot produce an oversized area, and a minimum spacing of 5 bars prevents the
same move from generating a cluster of near-identical zones.
**Invalidation** is configurable per engine: by wick or by close. Broken zones can stay
on the chart as historical reference or be hidden.
## The overlap and intensity system
Every enabled timeframe is scanned independently, and zones of the same kind and
direction that overlap in price are fused into a single box. The merged zone keeps the
union of the price range, inherits the identity of the **highest** timeframe involved,
and carries a counter of how many original zones it absorbed — shown as `xN` in the label
along with the timeframes it came from, e.g. `1 Hour & 15 Min OB x2`.
Opacity is then computed from two terms:
```
transparency = base − (timeframe rank × tf step) − ((overlap count − 1) × overlap step)
```
clamped to a configurable floor. In practice: a lone 15-minute zone is barely tinted,
while a cluster where the 15m, 1h and 4h all agree is strongly saturated. All four
constants are exposed in the *Color Intensity* settings group, so you can make the effect
subtle or dramatic.
## Auto MTF
With **Auto MTF** enabled (default) the script ignores the manual slots and follows the
chart: it uses the current timeframe plus the next three standard ones above it. On a 5m
chart you get 5m, 15m, 1h and 4h; on a 4h chart you get 4h, D, W and M. Change the chart
timeframe and the zone set re-scales with it — no reconfiguration.
Turn Auto MTF off to drive the six slots manually. In both modes, timeframes lower than
the chart's and duplicate slots are disabled automatically.
## Retests, breaks and alerts
An **R** label marks each time price returns to a live zone (with a cooldown so a single
extended visit does not produce a stack of labels), and an optional **B** label marks the
bar where a zone is invalidated. Labels are cleaned up when their zone disappears.
Eight alert conditions are available: retest and break, for supply, demand, bullish OB
and bearish OB.
## Settings worth knowing
- **Max Distance To Last Bar** — how much history is processed. Lower it if the script
is slow on your machine, especially with six timeframes enabled.
- **OB / S&D Zone Count** — zones kept per type, per timeframe (One / Low / Medium / High).
This is the main control over chart clutter and object count.
- **Swing Length** — smaller values produce more, smaller order blocks.
- **Order Blocks / Supply & Demand** — either engine can be switched off entirely.
- **OB Volume Text** — hides the volume and imbalance line if you only want the boxes.
## How to use it
Treat it as a **map, not a trigger**. The zones tell you where imbalance was created and
where price may react; they say nothing on their own about direction or timing. A
practical reading order:
1. Prioritise the darkest boxes — high timeframe, high overlap.
2. Prefer zones with few or no `R` labels; each retest consumes whatever resting interest
the level held.
3. Use the volume imbalance to tell a decisive origin from a contested one.
4. Wait for your own confirmation *inside* the zone (rejection, absorption, a signal from
another tool) rather than trading the touch itself.
On lower timeframes price interacts with some zone almost constantly, so a zone touch
by itself is a very weak piece of evidence. The value of this script is in showing you
where several independent readings of the market point at the same price — and in letting
you ignore the rest.
## Credits and license
This is a derivative work that merges and extends two open-source scripts by
**fluxchart**: *Volumized Order Blocks | Flux Charts* and *Supply & Demand (MTF) |
Flux Charts*. The detection logic of both engines is preserved from the originals.
Released under the same **Mozilla Public License 2.0**: mozilla.org/MPL/2.0/
What this version adds over the originals: both engines running side by side in one
script; multi-timeframe support extended to the Order Block engine (the original was
chart-timeframe only); the overlap counter and the timeframe/confluence based opacity
model; Auto MTF; retest and break labels unified across both engines; and the removal
of the internal volume bars in favour of a cleaner multi-timeframe view.
## Disclaimer
This indicator is a visualisation and context tool. It does not generate buy or sell
signals, it makes no claim about future performance, and it should not be used as the
sole basis for a trading decision. Test any approach on your own data before risking
capital.
## Overview
Most order block and supply/demand tools draw zones for a single timeframe. That
forces you to flip between charts to know whether the level you are looking at also
matters on the higher timeframes — and by the time you flip back, the reaction is over.
This script merges **two different zone engines** — Volumized Order Blocks and
Supply & Demand — and renders both across **up to six timeframes at once** on a single
chart. Instead of a wall of boxes, it encodes the important part as **color intensity**:
the more confluence at a price level, and the higher the timeframe it comes from, the
more opaque the zone. One glance tells you which levels are worth your attention.
## How the zones are detected
The script runs two independent detection engines. They never mix with each other:
an order block is only ever merged with another order block of the same direction, and
a demand zone only with another demand zone.
**Order Blocks (structure based).** A swing high/low is confirmed with a configurable
swing length (default 10). When a close breaks that swing, the script walks back through
the impulse to find the origin candle — the lowest low before a bullish break, the
highest high before a bearish one — and marks that candle's range as the zone. Zones
larger than 3.5×ATR(10) are discarded as noise. Each block also stores the volume of the
three candles that produced the break, split into buy-side and sell-side, and displays
the total plus an imbalance percentage (for example `24.657M (32%)`). A low percentage
means the break was one-sided; a high percentage means it was contested.
**Supply & Demand (momentum based).** When four consecutive candles print bodies larger
than half the 20-period average body in the same direction, the script marks the base
candle that preceded the burst. These zones are clamped to 1.5×ATR(20) so a single wide
candle cannot produce an oversized area, and a minimum spacing of 5 bars prevents the
same move from generating a cluster of near-identical zones.
**Invalidation** is configurable per engine: by wick or by close. Broken zones can stay
on the chart as historical reference or be hidden.
## The overlap and intensity system
Every enabled timeframe is scanned independently, and zones of the same kind and
direction that overlap in price are fused into a single box. The merged zone keeps the
union of the price range, inherits the identity of the **highest** timeframe involved,
and carries a counter of how many original zones it absorbed — shown as `xN` in the label
along with the timeframes it came from, e.g. `1 Hour & 15 Min OB x2`.
Opacity is then computed from two terms:
```
transparency = base − (timeframe rank × tf step) − ((overlap count − 1) × overlap step)
```
clamped to a configurable floor. In practice: a lone 15-minute zone is barely tinted,
while a cluster where the 15m, 1h and 4h all agree is strongly saturated. All four
constants are exposed in the *Color Intensity* settings group, so you can make the effect
subtle or dramatic.
## Auto MTF
With **Auto MTF** enabled (default) the script ignores the manual slots and follows the
chart: it uses the current timeframe plus the next three standard ones above it. On a 5m
chart you get 5m, 15m, 1h and 4h; on a 4h chart you get 4h, D, W and M. Change the chart
timeframe and the zone set re-scales with it — no reconfiguration.
Turn Auto MTF off to drive the six slots manually. In both modes, timeframes lower than
the chart's and duplicate slots are disabled automatically.
## Retests, breaks and alerts
An **R** label marks each time price returns to a live zone (with a cooldown so a single
extended visit does not produce a stack of labels), and an optional **B** label marks the
bar where a zone is invalidated. Labels are cleaned up when their zone disappears.
Eight alert conditions are available: retest and break, for supply, demand, bullish OB
and bearish OB.
## Settings worth knowing
- **Max Distance To Last Bar** — how much history is processed. Lower it if the script
is slow on your machine, especially with six timeframes enabled.
- **OB / S&D Zone Count** — zones kept per type, per timeframe (One / Low / Medium / High).
This is the main control over chart clutter and object count.
- **Swing Length** — smaller values produce more, smaller order blocks.
- **Order Blocks / Supply & Demand** — either engine can be switched off entirely.
- **OB Volume Text** — hides the volume and imbalance line if you only want the boxes.
## How to use it
Treat it as a **map, not a trigger**. The zones tell you where imbalance was created and
where price may react; they say nothing on their own about direction or timing. A
practical reading order:
1. Prioritise the darkest boxes — high timeframe, high overlap.
2. Prefer zones with few or no `R` labels; each retest consumes whatever resting interest
the level held.
3. Use the volume imbalance to tell a decisive origin from a contested one.
4. Wait for your own confirmation *inside* the zone (rejection, absorption, a signal from
another tool) rather than trading the touch itself.
On lower timeframes price interacts with some zone almost constantly, so a zone touch
by itself is a very weak piece of evidence. The value of this script is in showing you
where several independent readings of the market point at the same price — and in letting
you ignore the rest.
## Credits and license
This is a derivative work that merges and extends two open-source scripts by
**fluxchart**: *Volumized Order Blocks | Flux Charts* and *Supply & Demand (MTF) |
Flux Charts*. The detection logic of both engines is preserved from the originals.
Released under the same **Mozilla Public License 2.0**: mozilla.org/MPL/2.0/
What this version adds over the originals: both engines running side by side in one
script; multi-timeframe support extended to the Order Block engine (the original was
chart-timeframe only); the overlap counter and the timeframe/confluence based opacity
model; Auto MTF; retest and break labels unified across both engines; and the removal
of the internal volume bars in favour of a cleaner multi-timeframe view.
## Disclaimer
This indicator is a visualisation and context tool. It does not generate buy or sell
signals, it makes no claim about future performance, and it should not be used as the
sole basis for a trading decision. Test any approach on your own data before risking
capital.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.