Sessions backend frameworkSessions_Library — Session Timing Utilities (Pine v6)
Purpose
A lightweight helper library for indicator development that converts session strings (HHMM-HHMM) into same-day start/stop timestamps and provides a best-effort UTC offset resolver based on syminfo.timezone. This library does not draw, alert, or trade and must be called by a parent script.
Core Functions
- extractHourMinute(sessionInput): Returns from a "HHMM" string.
- ExtractStartStopTimestamp(sessionInput): Accepts "HHMM-HHMM" and returns using the current date.
- GetUTCOffset(): Maps common TradingView time zones to an integer UTC offset with fallbacks for UTC± and Etc/GMT± patterns.
Key Notes
- Backend-only tools: no signals, alerts, or order execution are included.
- Designed for educational, research, and indicator-development purposes.
- Time zone offsets are best-effort and simplified to whole hours; behavior may vary with regional DST rules and half-hour regions.
- No external data requests and no user data handling.
Usage
1) Import the library into your indicator.
2) Pass session strings like "0930-1030" to ExtractStartStopTimestamp for intraday windows.
3) Use GetUTCOffset to align logic across chart and exchange time. Visualization and alerting remain in the parent script.
Disclaimer
This library provides no financial advice, recommendations, or performance guarantees. Use at your own risk for research and educational development only.
Backend
Timing and Sessions backend frameworkTiming_Library — Timing Utilities (Pine v6)
Purpose
A lightweight timing toolkit for indicator development. It parses session strings, returns start/stop timestamps for the current day, and resolves a UTC offset for common TradingView time zones. The library itself does not draw, alert, or place trades and must be called by a parent indicator.
Core Functions
- extractHourMinute(sessionInput): Parses "HHMM" into .
- ExtractStartStopTimestamp(sessionInput): Accepts "HHMM-HHMM" and returns for the current date.
- GetUTCOffset(): Maps syminfo.timezone to an integer UTC offset (hours), with fallback parsing for UTC± patterns.
Key Notes
- Backend-only helper library: no signals, no alerts, no order execution.
- Designed for educational, research, and indicator-development purposes.
- No external data requests and no user data handling.
- Time zone handling is best-effort; behavior may vary with regional DST rules.
Usage
1) Import this library into your indicator.
2) Provide session inputs like "0930-1030" to ExtractStartStopTimestamp for same-day timestamps.
3) Use GetUTCOffset to align session logic or convert between local and exchange time where needed. Visualization and alerting remain in the parent script.
Disclaimer
This library does not provide financial advice, trade recommendations, or performance guarantees. Use at your own risk for research and educational development only.
Initial Daily Range backend frameworkIDR_Library — Back-End Logic (Pine v6)
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.