Update Description:
Issue Fixed: Vertical Lines on the First Opening Bar
In the previous version of this indicator, a bug caused the expected move lines to plot vertically on the first bar of the trading day. This issue occurred because the lines were initialized with both start (x1) and end (x2) coordinates set to the same bar_index at the market open. As a result, the lines appeared vertical for the duration of the first bar.
How the Update Fixes the Issue:
Delayed Line Creation: The updated code ensures that the lines are only created after the first bar of the day has fully formed. By checking if bar_index > 1 before initializing the lines, we ensure that the lines extend horizontally from the start.
Conditional Initialization: The lines are now conditionally initialized only when a new day begins (isNewDay). This prevents the premature creation of lines at the market open and ensures they are plotted correctly as horizontal lines.
Proper Line Extension: After the lines are created, the code sets the x2 coordinate to bar_index + 1, ensuring that the lines extend to the right immediately after creation, preventing any vertical lines from appearing.
Result: This update resolves the issue, ensuring that all expected move lines (including 0DTE and 2-sigma lines) are plotted as horizontal lines from the first completed bar of the day, eliminating any vertical line artifacts at the market open.