OPEN-SOURCE SCRIPT
Order Blocks & Breakers (HTF)

Order Blocks & Breakers (HTF)
Detects order blocks — the last opposite-colored candle before a decisive directional move — across up to three higher timeframes. A bullish OB is the last bearish candle before a bullish breakout; a bearish OB is the last bullish candle before a bearish breakdown. The SMC/ICT interpretation is that these are the candles where institutions accumulated or distributed positions, and price frequently returns to test them.
When an order block's defining edge fails — close below the bottom of a bullish OB, or close above the top of a bearish OB — the zone flips polarity and becomes a breaker. Former support becomes resistance, and vice versa. Breakers render in distinct colors so the flip is immediately visible without having to track which zone was originally which.
How it works
For each of the three configured timeframes, the script runs OB detection inside request.security:
New OBs pass an optional minimum-size filter (height as percentage of ATR). On every chart bar, all stored zones are evaluated for two state transitions:
A zone is in one of three states at any time:
All boxes and labels are rebuilt on the last bar so styling and right-edge timestamps stay current.
How to read it
Each timeframe is differentiated by border weight (thin → medium → thick), leaving color free to carry direction and state.
Four directional colors:
The simple mental model: blue and teal are "expect a bounce up here"; orange and red are "expect rejection down here." Breakers are the role-reversal flavor of the same idea.
Labels on active zones show the timeframe, type (OB or BB), and the zone's height as a percentage of ATR — a quick read on whether the zone is structurally meaningful or barely-there noise.
When zones from different timeframes stack at the same price, that's confluence — and tends to matter more than any zone in isolation.
Inputs
Built-in alerts
The "entered" alerts treat OBs and breakers together — both are bullish (or bearish) zones regardless of how they originated.
Notes
The breaker mechanic is what makes this indicator more than a labeled support/resistance tool. A bullish OB that holds is a support zone; a bullish OB that fully breaks becomes resistance — and that's structurally informative. Tracking the polarity flip keeps the zone in play instead of discarding it.
Mitigated-but-unbroken zones are off by default because they accumulate quickly and clutter the chart. Turn them on if you want to see which zones have been tested and defended without flipping.
Two mitigation styles, no "Full fill" option: for OBs, "Full fill" and "Breaker" describe the same event — the zone has been completely violated — so the breaker conversion replaces the third mitigation rule the FVG indicator offers.
OBs versus FVGs: an FVG is an unfilled price imbalance (a gap in the candles); an OB is a causally meaningful candle (the supposed source of institutional orders). The detection logic here is purely mechanical, so whether you accept the institutional-flow framing or just treat OBs as well-defined zones at recent inflection points, the indicator works the same way.
The framework here borrows from Smart Money Concepts / ICT trading. Whether you accept the underlying claim or just use OBs as a clean way to mark recent inflection candles, the indicator is purely mechanical: it finds the patterns and tracks how price behaves at them.
This is a structural tool, not a signal generator. It marks order blocks, tracks their state, and flags polarity flips.
Five years of work on a trading system left me with dozens of indicators that ultimately didn't earn a place in the final build. They're not failures — they're tools that solved problems I no longer needed solved. So instead of shelving them, I'm publishing the majority of them open-source.
If you're a discretionary trader, take what's useful. If you're a systems builder, the source is yours to dissect, modify, and improve. The best return on five years of work is for it to keep working — for someone.
If you use this script — or part of it — in your own work, please credit the original with a link back to my profile.
Note: these indicators have been updated to Pine Script v6 — some manually, some with AI assistance.
Detects order blocks — the last opposite-colored candle before a decisive directional move — across up to three higher timeframes. A bullish OB is the last bearish candle before a bullish breakout; a bearish OB is the last bullish candle before a bearish breakdown. The SMC/ICT interpretation is that these are the candles where institutions accumulated or distributed positions, and price frequently returns to test them.
When an order block's defining edge fails — close below the bottom of a bullish OB, or close above the top of a bearish OB — the zone flips polarity and becomes a breaker. Former support becomes resistance, and vice versa. Breakers render in distinct colors so the flip is immediately visible without having to track which zone was originally which.
How it works
For each of the three configured timeframes, the script runs OB detection inside request.security:
- Bullish OB when close[1] < open[1] and close > high[1] — the previous candle was bearish, the current candle closed above the previous high. The OB is the previous bearish candle.
- Bearish OB when close[1] > open[1] and close < low[1] — the previous candle was bullish, the current candle closed below the previous low. The OB is the previous bullish candle.
New OBs pass an optional minimum-size filter (height as percentage of ATR). On every chart bar, all stored zones are evaluated for two state transitions:
- Mitigation — first interaction with the zone. Configurable as Tap (any wick reaches the zone) or Close inside (a bar closes within the zone).
- Breaker conversion — close pushes through the zone's defining edge, fully invalidating the original direction. The zone flips polarity and stays active in its new role.
A zone is in one of three states at any time:
- Active — unmitigated, full color, extends right
- Mitigated (but defining edge still holds) — dimmed, dashed, optional
- Breaker — fully violated, flipped polarity, distinct breaker color, extends right
All boxes and labels are rebuilt on the last bar so styling and right-edge timestamps stay current.
How to read it
Each timeframe is differentiated by border weight (thin → medium → thick), leaving color free to carry direction and state.
Four directional colors:
- Bullish OB (default teal) — last bearish candle before an up-move; treat as support.
- Bearish OB (default red) — last bullish candle before a down-move; treat as resistance.
- Bull Breaker (default blue) — former bearish OB whose resistance failed. Now acts as support.
- Bear Breaker (default orange) — former bullish OB whose support failed. Now acts as resistance.
The simple mental model: blue and teal are "expect a bounce up here"; orange and red are "expect rejection down here." Breakers are the role-reversal flavor of the same idea.
Labels on active zones show the timeframe, type (OB or BB), and the zone's height as a percentage of ATR — a quick read on whether the zone is structurally meaningful or barely-there noise.
When zones from different timeframes stack at the same price, that's confluence — and tends to matter more than any zone in isolation.
Inputs
- Bullish / Bearish OBs — toggle each direction independently.
- Show Breakers — render flipped-polarity zones. Default on.
- Show mitigated OBs — keep mitigated, unbroken zones on chart. Default off, since these accumulate quickly.
- Labels — show or hide right-edge labels with timeframe, type, and ATR%. Default on.
- Max OBs (per TF) — cap on unmitigated zones drawn per timeframe per direction. Default 5.
- Mitigation — Tap (wick) or Close inside (bar closes within the zone). Default Tap.
- Min size (% of ATR) — filter out zones smaller than this percentage of ATR. Default 0 (no filter).
- ATR Length — period for the ATR used by the size filter and labels. Default 14.
- Timeframes 1/2/3 — defaults: 1H, 4H, Daily. Each independently enabled. TF3 off by default.
- Colors — bullish OB, bearish OB, bull breaker, bear breaker, mitigated.
Built-in alerts
- New Bullish OB — fires when a new bullish OB is detected on any enabled timeframe
- New Bearish OB — same, for bearish
- Price entered Bullish zone — fires the first bar price interacts with any active bullish OB or bull breaker (across all enabled timeframes)
- Price entered Bearish zone — same, for bearish
The "entered" alerts treat OBs and breakers together — both are bullish (or bearish) zones regardless of how they originated.
Notes
The breaker mechanic is what makes this indicator more than a labeled support/resistance tool. A bullish OB that holds is a support zone; a bullish OB that fully breaks becomes resistance — and that's structurally informative. Tracking the polarity flip keeps the zone in play instead of discarding it.
Mitigated-but-unbroken zones are off by default because they accumulate quickly and clutter the chart. Turn them on if you want to see which zones have been tested and defended without flipping.
Two mitigation styles, no "Full fill" option: for OBs, "Full fill" and "Breaker" describe the same event — the zone has been completely violated — so the breaker conversion replaces the third mitigation rule the FVG indicator offers.
OBs versus FVGs: an FVG is an unfilled price imbalance (a gap in the candles); an OB is a causally meaningful candle (the supposed source of institutional orders). The detection logic here is purely mechanical, so whether you accept the institutional-flow framing or just treat OBs as well-defined zones at recent inflection points, the indicator works the same way.
The framework here borrows from Smart Money Concepts / ICT trading. Whether you accept the underlying claim or just use OBs as a clean way to mark recent inflection candles, the indicator is purely mechanical: it finds the patterns and tracks how price behaves at them.
This is a structural tool, not a signal generator. It marks order blocks, tracks their state, and flags polarity flips.
Five years of work on a trading system left me with dozens of indicators that ultimately didn't earn a place in the final build. They're not failures — they're tools that solved problems I no longer needed solved. So instead of shelving them, I'm publishing the majority of them open-source.
If you're a discretionary trader, take what's useful. If you're a systems builder, the source is yours to dissect, modify, and improve. The best return on five years of work is for it to keep working — for someone.
If you use this script — or part of it — in your own work, please credit the original with a link back to my profile.
Note: these indicators have been updated to Pine Script v6 — some manually, some with AI assistance.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
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.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
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.