As my knowledge of Pine Script progresses, I have completely overhauled this script, rewriting it from scratch to optimize its structure, logic, and performance. Most calculations have been moved into functions to handle operations more efficiently. The most significant update is the new option to display any session as a high-low box. This feature made the separate custom session box from previous versions redundant, so it has been removed. I have also removed a couple more less common sessions for the sake of simplification. Given the overall flexibility in terms of possible customization, they seemed unnecessary to me.
Now, any session can be turned into a box showing the highest high and the lowest low reached during the given period, making the script much more flexible. Everything remains fully customizable, including the start and end times of all sessions, active days of the week, and colors. Various conditions have been addressed to ensure the script plots data correctly across multiple symbol types (forex, indices, crypto, and futures).
This turned out to be a meticulous task requiring extensive testing, as there are many intricacies to account for to ensure conditions don’t clash and results are correct regardless of the asset type the script is applied to. While it may not work 100% across all charts, my focus was on forex pairs, the dollar index, and crypto, as I am primarily a forex trader. I also made efforts to tweak it for futures, but this is particularly challenging and I don’t personally trade those, so it may not be the best use case. However, you can certainly give it a try, and I believe it should work for the most part.
Make sure to select the RTH vs. ETH in the script settings based on what you’re currently using. Additionally, it’s vital to select the correct time (EST vs. EDT) based on what is currently observed in New York, as failing to do so may result in boxes being plotted in the wrong places on the horizontal scale. Further tweaking may be needed once we switch back to EST in the fall later this year.
As a bonus, I have added an option to plot one more horizontal line representing the 'True Open' based on the Quarterly Theory.
This was quite a lot of work, but I’ll keep the script open. As is often the case with projects like this, I did this primarily for myself and my own pleasure. But it would be a shame not to share it with the community. Happy trading!