OPEN-SOURCE SCRIPT
Mis à jour

Bex DR

811
Bex DR/IDR is a professional Defining Range (DR) and Initial Defining Range (IDR) indicator for session-based traders.

Features:
• Regular, After-hours, and Overnight DR/IDR sessions
• Dynamic STD expansion levels
• Automatic DR body break detection
• Candle highlighting for breakout confirmation
• Configurable session ranges and extensions
• Optimized Pine Script v6 implementation
• Built for futures, forex, indices, gold, and crypto traders

The indicator helps identify:
• Session ranges
• Expansion targets
• Breakout confirmations
• Market structure shifts
• Intraday liquidity movements

Best suited for:
• ICT / SMC traders
• Futures traders
• NY session traders
• Scalpers and intraday traders
Notes de version
## New in This Update

- Added **DR/IDR body break detection** for session ranges.
- Highlights the **first valid body-break candle only** per session.
- Added **bullish and bearish break labels** with directional markers.
- Break detection now works using the **active session’s IDR levels** instead of previous session levels.
- Breaks are detected only during the **session extension period**.
- Added logic to prevent multiple break signals within the same session.
- Historical clutter reduced by showing break markers only for the **current trading day**.
- Improved session-based reset handling for cleaner real-time tracking.
- Added customizable bullish/bearish break colors in settings.

---

## Visual Improvements

- Cleaner chart appearance with simplified directional arrows.
- Better distinction between bullish and bearish body-break candles.
- Reduced unnecessary repeated highlights inside the same range.

---

## Internal Improvements

- Optimized intraday handling and session-state tracking.
- Refined DR/IDR extension behavior for more accurate session continuation.
Notes de version
Core Break Detection Overhaul

  • Independent Session Tracking: Break detection is no longer generalized. The script now individually tracks and stores the high and low of the Regular (RDR), After-hours (ADR), and Overnight (ODR) sessions upon their completion.
  • New Break Condition (First Close): The break logic has transitioned from "Body Breaks" (open inside, close outside) to "First Close Beyond DR Level." It now specifically triggers when the current close breaks the session high/low while the previous close was at or within the range.
  • Discrete Session States: Introduced isolated boolean flags for each session (e.g., adrBullBroken, odrBearBroken). Break states are now accurately reset at the end of each specific session rather than applying a global reset.


Visual & UI Adjustments

  • Unified Break Coloring: Both bullish and bearish breakout candles and labels now utilize a unified purple identifier (color.rgb(70, 26, 146)), shifting away from the previous multi-color (purple/yellow/green) setup.
  • Refined Labels: Breakout label sizes have been reduced from huge to normal for cleaner chart reading. (Note: The bearish label position was moved to track the high of the candle rather than the low).
  • Hidden Indicator Inputs: All configuration inputs across Time Settings, General Settings, and Styles have been appended with display = display.none. This locks in the indicator's parameters and removes the clutter from the TradingView settings panel.
  • Standard Deviation Lines: The showStdLines default state has been toggled from true to false.
  • Data Window Plots: Added hidden plots for ADR, ODR, and RDR highs and lows. While hidden from the main chart visual (display = display.none), these levels are now accessible via the TradingView Data Window for precise value tracking.


Under the Hood

  • Granular Variable Management: Deprecated the generic drHighBroken and drLowBroken variables in favor of dedicated stored variables (adrHigh, odrHigh, rdrStoredHigh, etc.) to prevent overlapping session data during extension periods.

Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.