OPEN-SOURCE SCRIPT
Enhanced Roman Order Block v2

Enhanced Roman Order Block Indicator v2
This indicator identifies and visualizes Order Blocks (OBs) on your chart, which are key price zones where institutional traders likely placed significant orders, often acting as support/resistance. It's an enhanced version inspired by standard OB detection scripts (like "Crystal Order Block"), but combines and improves upon them with practical features for better trading utility—avoiding a simple mashup by integrating complementary tools that work synergistically.
Originality and Enhancements:
Builds on basic candle-pattern OB detection but adds ATR-based minimum size filtering to ignore noise (e.g., small, insignificant blocks).
Includes optional Higher Timeframe (HTF) confirmation to validate OBs against larger trends, using confirmed data only (no lookahead bias—requests are offset for historical accuracy).
Customizable mitigation (wick or close-based) to detect when an OB is "touched" and potentially invalidated.
Adjustable lookback for pattern flexibility, box extensions, price lines, max displayed OBs (to declutter charts), and alerts for formation/mitigation.
These features merge to create a more reliable, user-configurable tool: e.g., HTF checks + ATR filters reduce false positives, while alerts + lines help in live trading without overwhelming the chart.
How It Works:
Detection Logic: Scans recent candles (default lookback=3) for bullish OBs (e.g., a low that's lower than prior but higher than subsequent swings, indicating accumulation) or bearish OBs (opposite for distribution). Formulas: Bullish = (B_low < A_low) AND (C_low > B_low) AND ((C_low > B_high) OR (D_low > B_high)); similar for bearish.
Filters: OBs must exceed ATR * minOBSizeATR (default 0.5) for validity. If HTF enabled, confirms the OB aligns with HTF lows/highs.
Mitigation: Tracks OBs and shortens boxes/lines when price wicks/closes into the mitigation level (top for bullish, bottom for bearish).
Display: Draws semi-transparent boxes (extendable), optional dashed lines, and labels. Limits to maxOBs, removing oldest.
Alerts: Triggers on new OBs or mitigations for timely notifications.
Underlying concept: OBs stem from Smart Money Concepts (SMC), where big players leave "footprints" in price structure— this script automates detection with risk-aware tweaks.
How to Use:
Add to chart (works on any timeframe/symbol, e.g., crypto like ETHUSD).
Inputs:
Order Block Settings: Toggle bullish/bearish/mitigated visibility; choose mitigation type; set min size/lookback.
Display: Adjust extensions, enable lines, limit max OBs.
Alerts: Enable for OB events.
Multi-Timeframe: Input a higher TF (e.g., "D" for daily) for confirmation—ensures OBs respect bigger-picture levels.
This indicator identifies and visualizes Order Blocks (OBs) on your chart, which are key price zones where institutional traders likely placed significant orders, often acting as support/resistance. It's an enhanced version inspired by standard OB detection scripts (like "Crystal Order Block"), but combines and improves upon them with practical features for better trading utility—avoiding a simple mashup by integrating complementary tools that work synergistically.
Originality and Enhancements:
Builds on basic candle-pattern OB detection but adds ATR-based minimum size filtering to ignore noise (e.g., small, insignificant blocks).
Includes optional Higher Timeframe (HTF) confirmation to validate OBs against larger trends, using confirmed data only (no lookahead bias—requests are offset for historical accuracy).
Customizable mitigation (wick or close-based) to detect when an OB is "touched" and potentially invalidated.
Adjustable lookback for pattern flexibility, box extensions, price lines, max displayed OBs (to declutter charts), and alerts for formation/mitigation.
These features merge to create a more reliable, user-configurable tool: e.g., HTF checks + ATR filters reduce false positives, while alerts + lines help in live trading without overwhelming the chart.
How It Works:
Detection Logic: Scans recent candles (default lookback=3) for bullish OBs (e.g., a low that's lower than prior but higher than subsequent swings, indicating accumulation) or bearish OBs (opposite for distribution). Formulas: Bullish = (B_low < A_low) AND (C_low > B_low) AND ((C_low > B_high) OR (D_low > B_high)); similar for bearish.
Filters: OBs must exceed ATR * minOBSizeATR (default 0.5) for validity. If HTF enabled, confirms the OB aligns with HTF lows/highs.
Mitigation: Tracks OBs and shortens boxes/lines when price wicks/closes into the mitigation level (top for bullish, bottom for bearish).
Display: Draws semi-transparent boxes (extendable), optional dashed lines, and labels. Limits to maxOBs, removing oldest.
Alerts: Triggers on new OBs or mitigations for timely notifications.
Underlying concept: OBs stem from Smart Money Concepts (SMC), where big players leave "footprints" in price structure— this script automates detection with risk-aware tweaks.
How to Use:
Add to chart (works on any timeframe/symbol, e.g., crypto like ETHUSD).
Inputs:
Order Block Settings: Toggle bullish/bearish/mitigated visibility; choose mitigation type; set min size/lookback.
Display: Adjust extensions, enable lines, limit max OBs.
Alerts: Enable for OB events.
Multi-Timeframe: Input a higher TF (e.g., "D" for daily) for confirmation—ensures OBs respect bigger-picture levels.
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.