OPEN-SOURCE SCRIPT
ICT Order Blocks + Alerts

Order Block Identify & Verify
An educational Order Block (OB) indicator that finds ICT-style order blocks, confirms them with a volatility-filtered displacement candle, and tracks each level until price taps it or invalidates it. Every part of the chart is marked with a simple icon so you can learn to recognize order blocks on your own.
━━━ WHAT IS AN ORDER BLOCK? ━━━
An order block is the last opposite-direction candle before a strong move (displacement). Price often comes back to this level later, where it can act as support (bullish OB) or resistance (bearish OB).
━━━ HOW IT WORKS ━━━
Bullish OB (OB+)
• The OB candle is a down-close candle.
• The next candle is a strong up-close candle that closes ABOVE the OB candle's open.
• The OB level is the OB candle's open.
Bearish OB (OB-)
• The OB candle is an up-close candle.
• The next candle is a strong down-close candle that closes BELOW the OB candle's open.
• The OB level is the OB candle's open.
Displacement filter
The displacement candle's body must be larger than ATR × your multiplier. Because ATR adapts to the instrument and timeframe, weak, noisy moves are ignored and only real displacement counts.
Invalidation
An OB is invalidated when a candle CLOSES through its level. Wicks alone don't count.
• OB+ is invalid when price closes below the line.
• OB- is invalid when price closes above the line.
━━━ CHART LEGEND ━━━
▲ / ▼ = Order block candle
✓ = Displacement confirmed
─── = Active OB level
- - - = Invalidated OB level (when "Stop Line at Mitigation" is off)
OB+ = Bullish order block (possible support)
OB- = Bearish order block (possible resistance)
━━━ ALERTS ━━━
Turn each one on or off under Inputs → Alerts:
• New OB formed: when the displacement candle closes, with the OB level in the message
• Price taps OB level: the first time price returns to an active OB (once per OB)
• OB invalidated: when a candle closes through an active OB
To set one up: Create Alert → Condition: Order Block Identify & Verify → then choose
• "Any alert() function call" for every event you enabled, with the price level, or
• a single condition (New OB+, OB- Tapped, OB+ Invalidated, etc.).
Tip: use "Once Per Bar Close" for New OB and Invalidated alerts so they only fire on closed candles.
━━━ SETTINGS ━━━
Order Blocks
• Max Bullish / Bearish OBs: how many active OBs of each side to show.
Filters
• Min Displacement (ATR multiplier): how strong the displacement candle must be. 1.0 is balanced. Lower values give more OBs, higher values fewer but stronger ones. Timeframe suggestions are in the setting's tooltip.
• ATR Length: lookback for the ATR (default 14).
Visuals
• Colors, line width, show/hide markers, icon size.
Mitigation
• Stop Line at Mitigation: end the line when the OB is invalidated, or keep it extending as a dashed line.
• Keep Mitigated OBs (per side): how many invalidated OBs stay on the chart for reference.
━━━ HOW TO USE IT ━━━
• Use it to learn what valid order blocks look like: the ▲▼ candle, the ✓ displacement, and the level price may return to.
• Watch how price reacts when it taps an OB level. Does it hold or close through?
• Combine it with your own context (higher-timeframe trend, liquidity, session timing). An OB by itself is not a trade signal.
━━━ PREVIOUS VERSION ━━━
This script replaces my earlier "OB Education Tool". The original is here: [LINK]
━━━ DISCLAIMER ━━━
This indicator is for educational purposes only and is not financial advice. Order blocks are areas of interest, not guarantees. Always manage your risk.
An educational Order Block (OB) indicator that finds ICT-style order blocks, confirms them with a volatility-filtered displacement candle, and tracks each level until price taps it or invalidates it. Every part of the chart is marked with a simple icon so you can learn to recognize order blocks on your own.
━━━ WHAT IS AN ORDER BLOCK? ━━━
An order block is the last opposite-direction candle before a strong move (displacement). Price often comes back to this level later, where it can act as support (bullish OB) or resistance (bearish OB).
━━━ HOW IT WORKS ━━━
Bullish OB (OB+)
• The OB candle is a down-close candle.
• The next candle is a strong up-close candle that closes ABOVE the OB candle's open.
• The OB level is the OB candle's open.
Bearish OB (OB-)
• The OB candle is an up-close candle.
• The next candle is a strong down-close candle that closes BELOW the OB candle's open.
• The OB level is the OB candle's open.
Displacement filter
The displacement candle's body must be larger than ATR × your multiplier. Because ATR adapts to the instrument and timeframe, weak, noisy moves are ignored and only real displacement counts.
Invalidation
An OB is invalidated when a candle CLOSES through its level. Wicks alone don't count.
• OB+ is invalid when price closes below the line.
• OB- is invalid when price closes above the line.
━━━ CHART LEGEND ━━━
▲ / ▼ = Order block candle
✓ = Displacement confirmed
─── = Active OB level
- - - = Invalidated OB level (when "Stop Line at Mitigation" is off)
OB+ = Bullish order block (possible support)
OB- = Bearish order block (possible resistance)
━━━ ALERTS ━━━
Turn each one on or off under Inputs → Alerts:
• New OB formed: when the displacement candle closes, with the OB level in the message
• Price taps OB level: the first time price returns to an active OB (once per OB)
• OB invalidated: when a candle closes through an active OB
To set one up: Create Alert → Condition: Order Block Identify & Verify → then choose
• "Any alert() function call" for every event you enabled, with the price level, or
• a single condition (New OB+, OB- Tapped, OB+ Invalidated, etc.).
Tip: use "Once Per Bar Close" for New OB and Invalidated alerts so they only fire on closed candles.
━━━ SETTINGS ━━━
Order Blocks
• Max Bullish / Bearish OBs: how many active OBs of each side to show.
Filters
• Min Displacement (ATR multiplier): how strong the displacement candle must be. 1.0 is balanced. Lower values give more OBs, higher values fewer but stronger ones. Timeframe suggestions are in the setting's tooltip.
• ATR Length: lookback for the ATR (default 14).
Visuals
• Colors, line width, show/hide markers, icon size.
Mitigation
• Stop Line at Mitigation: end the line when the OB is invalidated, or keep it extending as a dashed line.
• Keep Mitigated OBs (per side): how many invalidated OBs stay on the chart for reference.
━━━ HOW TO USE IT ━━━
• Use it to learn what valid order blocks look like: the ▲▼ candle, the ✓ displacement, and the level price may return to.
• Watch how price reacts when it taps an OB level. Does it hold or close through?
• Combine it with your own context (higher-timeframe trend, liquidity, session timing). An OB by itself is not a trade signal.
━━━ PREVIOUS VERSION ━━━
This script replaces my earlier "OB Education Tool". The original is here: [LINK]
━━━ DISCLAIMER ━━━
This indicator is for educational purposes only and is not financial advice. Order blocks are areas of interest, not guarantees. Always manage your risk.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。