Custom Time Range Boxes + Fibs + Extension

We are thrilled to release a significantly improved version of the Custom Time Range Boxes + Fibs + Extension Pine Script indicator! This update addresses critical issues in the original code, enhances compatibility with Pine Script version 5, and ensures a more robust and reliable experience for traders. Below, we outline the key improvements and provide the updated code for you to use and share.
What's New and Improved?
The original script, while functional, encountered several errors that limited its usability, including issues with nested arrays, incorrect timeframe identifiers, and restricted request.security calls. This updated version resolves these problems and introduces the following enhancements:
Resolved Nested Array Error:
The original code used unsupported nested arrays (array<array<line>>) to store Fibonacci lines, causing compilation errors. The updated version replaces this with a single array<line> and tracks line counts using an additional array<int>, ensuring compatibility with Pine Script's limitations while maintaining the ability to manage multiple Fibonacci lines per box.
Fixed Timeframe Identifier:
The original script incorrectly used timeframe.is_intraday, leading to an "Undeclared identifier" error. This has been corrected to timeframe.isintraday, ensuring proper detection of intraday timeframes and seamless operation across different chart settings.
Enabled Dynamic Security Requests:
The original code placed request.security calls within conditional blocks, which violated Pine Script's restrictions and triggered errors. The updated version moves these calls outside conditionals and enables dynamic_requests=true in the indicator() function, allowing flexible data retrieval from the 1-hour timeframe without compromising functionality.
Preserved Core Functionality:
Despite these technical improvements, the core functionality remains intact: the indicator draws customizable time-based boxes with Fibonacci retracement levels (0.3, 0.5, 0.7) on the chart, supports two separate sessions, and extends boxes for a user-defined number of candles. The update ensures that all features work as intended, with improved stability.
Enhanced Reliability:
By addressing these errors, the updated script is more robust, reducing the likelihood of runtime issues and making it suitable for public use. It now handles edge cases better, such as invalid time ranges, and provides clear error messages when configurations are incorrect.
Why This Version Is Better
Compared to the original code, this version is a leap forward in terms of reliability, compatibility, and user experience. The original script was hindered by compilation errors that prevented it from running correctly in many scenarios. The updated version not only fixes these issues but also ensures that the indicator performs consistently across different timeframes and configurations. Whether you're a trader looking to visualize key session ranges or a developer seeking a reliable base for further customization, this script is now ready for prime time.
Try It Out!
We invite you to test the updated Custom Time Range Boxes + Fibs + Extension indicator on TradingView. Customize the session times, box lengths, and colors to suit your trading strategy, and enjoy the seamless integration of Fibonacci levels for better market analysis. Feel free to share your feedback and suggestions for further improvements!
Below is the complete, updated Pine Script code for your use:
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.
Penafian
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.