Initial Daily Range backend framework

Purpose
This library provides the backend framework for implementing DR/IDR (Initial Daily Range) strategies.
It manages range data, retest logic, and optional visualization elements such as midlines and bands.
The library by itself does not draw, alert, or trade — it requires an external indicator that calls its functions.
Core Functionality
- SessionActive(): Tracks high/low/close data for the initial session range and updates zone boxes.
- DrawMidLine(): Calculates Fibonacci-based internal levels (upper/mid/lower) and optionally draws them.
- ExtendBands(): Extends the drawn lines and boxes dynamically over time.
- CheckForRetest(): Detects and validates retest sequences (First Leaving → Retest → Second Leaving).
- ResetVals(), GetNewDrIdr(): Utility functions for initialization and reset handling.
Data Structures
- CandleData, DrIdr, DrIdrSettings, Retest, RetestZone, RetestZones
Key Notes
- This library is modular and backend-only: it produces no visual output or alerts unless instructed by the parent script.
- It does not contain any financial signals or trading logic.
- Designed purely for educational, research, and indicator-development purposes.
- No external data requests or user information handling.
Usage
1. Import the library into a separate indicator script.
2. Create an instance of DrIdr and configure DrIdrSettings.
3. Call SessionActive(), DrawMidLine(), and ExtendBands() during your session.
4. Use CheckForRetest() to track range retest behavior; handle visualization and alerting in your indicator.
Disclaimer
This library does not provide financial advice, trade recommendations, or guaranteed performance.
Use at your own risk and only for research or educational development.
Pine Bibliothek
Ganz im Sinne von TradingView hat dieser Autor seinen/ihren Pine Code als Open-Source-Bibliothek veröffentlicht. Auf diese Weise können nun auch andere Pine-Programmierer aus unserer Community den Code verwenden. Vielen Dank an den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Veröffentlichungen verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert.
Haftungsausschluss
Pine Bibliothek
Ganz im Sinne von TradingView hat dieser Autor seinen/ihren Pine Code als Open-Source-Bibliothek veröffentlicht. Auf diese Weise können nun auch andere Pine-Programmierer aus unserer Community den Code verwenden. Vielen Dank an den Autor! Sie können diese Bibliothek privat oder in anderen Open-Source-Veröffentlichungen verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert.