OPEN-SOURCE SCRIPT
Supply & Demand Order Blocks [JOAT]

Supply and Demand Order Blocks [JOAT]
Detects institutional order blocks from displacement, tracks them until mitigated, and signals reactions when price returns to a fresh zone.

What it is
Large participants cannot fill size at a single price, so they leave a footprint: the last opposing candle before an aggressive, imbalanced push. That candle marks the zone where unfilled orders rest and where price often returns to be re-accumulated or re-distributed. This indicator locates those zones objectively, manages their lifecycle, and frames the reaction as a trade. It is an original order-block engine with strict zone management.
How it works
• Displacement — the engine measures each impulsive leg over a short window against an ATR multiple. Only moves that exceed that threshold (optionally requiring a fair-value gap) count as institutional displacement, filtering out ordinary candles.
• Order block — the last opposing candle before a qualifying displacement is stored as a zone: the last down candle before a bullish push becomes demand, the last up candle before a bearish push becomes supply.
• Zone management — active blocks are held in parallel arrays, drawn as boxes extended to the right, faded by age and saturated by displacement strength, pruned once mitigated (price closes through them), and capped at a live maximum so the chart stays clean.
• Signals — a Buy fires when price taps a fresh demand block and closes back up (a bullish rejection); a Sell is the mirror at a supply block. An optional trend filter keeps you buying demand in uptrends and selling supply in downtrends, and a minimum-age plus minimum-gap rule stops a freshly formed block from self-triggering and prevents clustering.
Trade levels
Each signal draws a red risk box from entry to a stop placed beyond the block and a green reward box to the third target, with inner dividers and right-edge labels for entry, stop and each take-profit at your R multiples.
The dashboard
An adjustable order-flow-depth panel shows the trend bias, the live counts of demand and supply blocks, the distance to the nearest zone, a conviction estimate, the active signal, and a live first-target-before-stop tally from closed bars only.
How to use it
• Works on any asset and timeframe; larger timeframes produce fewer, more significant blocks.
• Trade reactions at fresh, unmitigated zones aligned with the trend filter; treat mitigated zones as spent.
• Use the nearest-zone distance to anticipate where a reaction may occur before it happens.
Settings
Displacement window and ATR size, fair-value-gap requirement, maximum live blocks and extension, minimum block age, trend filter length, risk buffer and target R multiples, plus visual and dashboard controls.
Originality and usefulness
The contribution is the full lifecycle model: an ATR-based displacement filter, objective block selection, age-and-strength-aware zone rendering, mitigation-based pruning, and a self-trigger guard — combined with a trend-filtered, non-repainting reaction signal and explained end to end.
Notes and limitations
• Not every tap of a zone reverses; blocks can and do break, which is why mitigation pruning and stops exist.
• Order-block definitions vary between traders; this engine uses one consistent, disclosed definition.
• The tally reflects only past bars on the current chart and is not a forecast.
• Educational and analytical tool, not financial advice.
— made with passion by officialjackofalltrades
Detects institutional order blocks from displacement, tracks them until mitigated, and signals reactions when price returns to a fresh zone.
What it is
Large participants cannot fill size at a single price, so they leave a footprint: the last opposing candle before an aggressive, imbalanced push. That candle marks the zone where unfilled orders rest and where price often returns to be re-accumulated or re-distributed. This indicator locates those zones objectively, manages their lifecycle, and frames the reaction as a trade. It is an original order-block engine with strict zone management.
How it works
• Displacement — the engine measures each impulsive leg over a short window against an ATR multiple. Only moves that exceed that threshold (optionally requiring a fair-value gap) count as institutional displacement, filtering out ordinary candles.
• Order block — the last opposing candle before a qualifying displacement is stored as a zone: the last down candle before a bullish push becomes demand, the last up candle before a bearish push becomes supply.
• Zone management — active blocks are held in parallel arrays, drawn as boxes extended to the right, faded by age and saturated by displacement strength, pruned once mitigated (price closes through them), and capped at a live maximum so the chart stays clean.
• Signals — a Buy fires when price taps a fresh demand block and closes back up (a bullish rejection); a Sell is the mirror at a supply block. An optional trend filter keeps you buying demand in uptrends and selling supply in downtrends, and a minimum-age plus minimum-gap rule stops a freshly formed block from self-triggering and prevents clustering.
Trade levels
Each signal draws a red risk box from entry to a stop placed beyond the block and a green reward box to the third target, with inner dividers and right-edge labels for entry, stop and each take-profit at your R multiples.
The dashboard
An adjustable order-flow-depth panel shows the trend bias, the live counts of demand and supply blocks, the distance to the nearest zone, a conviction estimate, the active signal, and a live first-target-before-stop tally from closed bars only.
How to use it
• Works on any asset and timeframe; larger timeframes produce fewer, more significant blocks.
• Trade reactions at fresh, unmitigated zones aligned with the trend filter; treat mitigated zones as spent.
• Use the nearest-zone distance to anticipate where a reaction may occur before it happens.
Settings
Displacement window and ATR size, fair-value-gap requirement, maximum live blocks and extension, minimum block age, trend filter length, risk buffer and target R multiples, plus visual and dashboard controls.
Originality and usefulness
The contribution is the full lifecycle model: an ATR-based displacement filter, objective block selection, age-and-strength-aware zone rendering, mitigation-based pruning, and a self-trigger guard — combined with a trend-filtered, non-repainting reaction signal and explained end to end.
Notes and limitations
• Not every tap of a zone reverses; blocks can and do break, which is why mitigation pruning and stops exist.
• Order-block definitions vary between traders; this engine uses one consistent, disclosed definition.
• The tally reflects only past bars on the current chart and is not a forecast.
• Educational and analytical tool, not financial advice.
— made with passion by officialjackofalltrades
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
The AI Trading Ecosystem, Built to win trades 📈
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
The AI Trading Ecosystem, Built to win trades 📈
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.