OPEN-SOURCE SCRIPT
BTM - Order Blocks & Breaker Blocks Pro [Scored, Non-Repainting]

Order Blocks & Breaker Blocks Pro detects ICT-style order blocks only when they are backed by a confirmed break of market structure, scores each zone for quality, and automatically converts failed order blocks into breaker blocks.
WHY THIS INDICATOR IS DIFFERENT
Many order block tools box any large candle, which produces a lot of weak zones. This script requires a sequence of events before a zone is drawn: a confirmed swing, a break of that swing, and an origin candle the move can be traced back to. Each zone is then graded so you can filter for the strongest ones.
HOW IT WORKS
1. Market structure
Swing highs and lows are confirmed pivots, so they never repaint. When price closes beyond the last unbroken swing, the script marks a BOS (break of structure, trend continuation) or a CHoCH (change of character, possible reversal).
2. Order block detection
The move that caused the break is traced back to its origin. The last opposite-coloured candle at that origin is marked as the order block. You can choose between the last opposite candle (classic ICT definition) or the extreme candle of the move, and between the full wick range or the candle body only.
3. Quality score (0–4 stars)
Each order block earns one point for each of the following:
- Displacement – a strong candle (body of at least 1.2× ATR by default) in the move away from the zone
- Fair value gap – the move left a price imbalance
- Liquidity sweep – the zone took out the previous swing low or high
- Volume – the order block candle had above-average volume
Any of these can be made mandatory, and you can set a minimum score.
4. Breaker blocks
If price later closes through the far side of an order block, the zone has failed. Because every order block here was created by a break of structure that already took liquidity, its failure flips it into a breaker block with the opposite role:
- A failed bullish order block becomes a bearish breaker (resistance)
- A failed bearish order block becomes a bullish breaker (support)
A breaker is invalidated when price closes through its far side.
COLOUR KEY
- Green – Bullish order block (support)
- Red – Bearish order block (resistance)
- Blue – Bullish breaker (support)
- Orange – Bearish breaker (resistance)
- Dotted line – 50% level of the zone (consequent encroachment)
- Faded zone – already retested once
DASHBOARD
A colour-coded table shows the current structure direction, the nearest support and resistance zones with their price range and distance, and the number of active zones of each type. Position, size, theme and accent colour are all adjustable.
HOW TO USE IT
1. Check the structure direction on the dashboard.
2. In a bullish structure, look for price to return to green or blue zones. In a bearish structure, look to red or orange zones.
3. Wait for a reaction inside the zone, such as a rejection wick or a strong candle in your direction, rather than entering on the first touch.
4. A close through the far side of the zone invalidates the idea, which makes it a natural stop-loss reference.
5. The nearest opposing zone can serve as a target.
SUGGESTED SETTINGS
- Minimum quality score of 2 for cleaner charts
- "Remove OB after first retest" to show only untouched zones
- Higher swing length (15–20) for higher timeframes and swing trading, lower (5) for scalping
NON-REPAINTING
Swings are confirmed pivots, and by default the script only acts on closed candles, so zones do not appear and disappear on the live candle. Note that, because pivots need confirmation, structure breaks are recognised only after the swing is confirmed.
ALERTS
Alerts are available for new bullish and bearish order blocks, new breakers, retests of each zone type, and a combined "any event" alert.
DISCLAIMER
This indicator is a tool for identifying price zones based on market structure concepts. It does not predict future price movement and is not financial advice. Zones can and do fail. Always test it on historical data, use proper risk management, and make your own trading decisions.
WHY THIS INDICATOR IS DIFFERENT
Many order block tools box any large candle, which produces a lot of weak zones. This script requires a sequence of events before a zone is drawn: a confirmed swing, a break of that swing, and an origin candle the move can be traced back to. Each zone is then graded so you can filter for the strongest ones.
HOW IT WORKS
1. Market structure
Swing highs and lows are confirmed pivots, so they never repaint. When price closes beyond the last unbroken swing, the script marks a BOS (break of structure, trend continuation) or a CHoCH (change of character, possible reversal).
2. Order block detection
The move that caused the break is traced back to its origin. The last opposite-coloured candle at that origin is marked as the order block. You can choose between the last opposite candle (classic ICT definition) or the extreme candle of the move, and between the full wick range or the candle body only.
3. Quality score (0–4 stars)
Each order block earns one point for each of the following:
- Displacement – a strong candle (body of at least 1.2× ATR by default) in the move away from the zone
- Fair value gap – the move left a price imbalance
- Liquidity sweep – the zone took out the previous swing low or high
- Volume – the order block candle had above-average volume
Any of these can be made mandatory, and you can set a minimum score.
4. Breaker blocks
If price later closes through the far side of an order block, the zone has failed. Because every order block here was created by a break of structure that already took liquidity, its failure flips it into a breaker block with the opposite role:
- A failed bullish order block becomes a bearish breaker (resistance)
- A failed bearish order block becomes a bullish breaker (support)
A breaker is invalidated when price closes through its far side.
COLOUR KEY
- Green – Bullish order block (support)
- Red – Bearish order block (resistance)
- Blue – Bullish breaker (support)
- Orange – Bearish breaker (resistance)
- Dotted line – 50% level of the zone (consequent encroachment)
- Faded zone – already retested once
DASHBOARD
A colour-coded table shows the current structure direction, the nearest support and resistance zones with their price range and distance, and the number of active zones of each type. Position, size, theme and accent colour are all adjustable.
HOW TO USE IT
1. Check the structure direction on the dashboard.
2. In a bullish structure, look for price to return to green or blue zones. In a bearish structure, look to red or orange zones.
3. Wait for a reaction inside the zone, such as a rejection wick or a strong candle in your direction, rather than entering on the first touch.
4. A close through the far side of the zone invalidates the idea, which makes it a natural stop-loss reference.
5. The nearest opposing zone can serve as a target.
SUGGESTED SETTINGS
- Minimum quality score of 2 for cleaner charts
- "Remove OB after first retest" to show only untouched zones
- Higher swing length (15–20) for higher timeframes and swing trading, lower (5) for scalping
NON-REPAINTING
Swings are confirmed pivots, and by default the script only acts on closed candles, so zones do not appear and disappear on the live candle. Note that, because pivots need confirmation, structure breaks are recognised only after the swing is confirmed.
ALERTS
Alerts are available for new bullish and bearish order blocks, new breakers, retests of each zone type, and a combined "any event" alert.
DISCLAIMER
This indicator is a tool for identifying price zones based on market structure concepts. It does not predict future price movement and is not financial advice. Zones can and do fail. Always test it on historical data, use proper risk management, and make your own trading decisions.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.