lower_tf

█ OVERVIEW
This library is an enhanced (opinionated) version of the library originally developed by PineCoders contained in lower_tf.
It is a Pine Script® programming tool for advanced lower-timeframe selection and intra-bar analysis.
█ CONCEPTS
Lower Timeframe Analysis
Lower timeframe analysis refers to the analysis of price action and market microstructure using data from timeframes shorter than the current chart period. This technique allows traders and analysts to gain deeper insights into market dynamics, volume distribution, and the price movements occurring within each bar on the chart. In Pine Script®, the request.security_lower_tf() function allows this analysis by accessing intrabar data.
The library provides a comprehensive set of functions for accurate mapping of lower timeframes, dynamic precision control, and optimized historical coverage using request.security_lower_tf().
█ IMPROVEMENTS
The original library implemented ten precision levels. This enhanced version extends that to twelve levels, adding two ultra-high-precision options:
Coverage-Based Precision (Original 5 levels):
1. "Covering most chart bars (least precise)"
2. "Covering some chart bars (less precise)"
3. "Covering fewer chart bars (more precise)"
4. "Covering few chart bars (very precise)"
5. "Covering the least chart bars (most precise)"
Intrabar-Count-Based Precision (Expanded from 5 to 7 levels):
6. "~12 intrabars per chart bar"
7. "~24 intrabars per chart bar"
8. "~50 intrabars per chart bar"
9. "~100 intrabars per chart bar"
10. "~250 intrabars per chart bar"
11. "~500 intrabars per chart bar" ← NEW
12. "~1000 intrabars per chart bar" ← NEW
The key enhancements in this version include:
1. Extended Precision Range: Adds two ultra-high-precision levels (~500 and ~1000 intrabars) for advanced microstructure analysis requiring maximum granularity.
2. Market-Agnostic Implementation: Eliminates the distinction between crypto/forex and traditional markets, removing the mktFactor variable in favor of a unified, predictable approach across all asset classes.
3. Explicit Precision Mapping: Completely refactors the timeframe selection logic using native Pine Script® timeframe properties (timeframe.isseconds, timeframe.isminutes, timeframe.isdaily, timeframe.isweekly, timeframe.ismonthly) and explicit multiplier-based lookup tables. The original library used minute-based calculations with market-dependent conditionals that produced inconsistent results. This version provides deterministic, predictable mappings for every chart timeframe, ensuring consistent precision behavior regardless of asset type or market hours.
An example of the differences can be seen side-by-side in the chart below, where the original library is on the left and the enhanced version is on the right:
█ USAGE EXAMPLE
█ EXPORTED FUNCTIONS
ltf(userSelection, choice1, choice2, ...)
Returns the optimal lower timeframe string based on user selection and current chart timeframe. Dynamically calculates precision to balance granularity with historical coverage within the 200K intrabar limit.
ltfStats(intrabarValues)
Analyzes an intrabar array returned by request.security_lower_tf() and returns statistics: number of intrabars in current bar, total chart bars covered, and average intrabars per bar.
█ CREDITS AND LICENSING
Original Concept: PineCoders Team
Original Lower TF Library:

License: Mozilla Public License 2.0
Perpustakaan Pine
Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai perpustakaan sumber terbuka supaya pengaturcara Pine lain dari komuniti kami boleh menggunakannya semula. Sorakan kepada penulis! Anda juga boleh menggunakan perpustakaan ini secara peribadi atau dalam penerbitan sumber terbuka lain, tetapi penggunaan semula kod ini dalam penerbitan adalah tertakluk kepada Peraturan Dalaman.
⚡Bitcoin Lightning: forwardocean64@walletofsatoshi.com
🟠Bitcoin: bc1qv0j28wjsg6l8fdkphkmgfz4f55xpph893q0pdh
🔵PayPal: paypal.com/donate/?hosted_button_id=D9KRKY5HMSL9S
Penafian
Perpustakaan Pine
Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai perpustakaan sumber terbuka supaya pengaturcara Pine lain dari komuniti kami boleh menggunakannya semula. Sorakan kepada penulis! Anda juga boleh menggunakan perpustakaan ini secara peribadi atau dalam penerbitan sumber terbuka lain, tetapi penggunaan semula kod ini dalam penerbitan adalah tertakluk kepada Peraturan Dalaman.
⚡Bitcoin Lightning: forwardocean64@walletofsatoshi.com
🟠Bitcoin: bc1qv0j28wjsg6l8fdkphkmgfz4f55xpph893q0pdh
🔵PayPal: paypal.com/donate/?hosted_button_id=D9KRKY5HMSL9S