I'm creating a script that I want to plot a few horizontal lines on top of a chart. I'm doing this by calling plot() and passing an int that only changes monthly.
I've got it working how I'd like except for one problem. At the month transitions, I get a vertical line on my chart (as part of the step function). How can I get rid of this?
Ideas I had but can't find a means to execute:
- Plot "na" where I want the breaks. In the script, I can determine when I'm on the first day of the month. If I pass na here, for some reason, the plot still renders the vertical step down/up, then a gap, then the beginning of the next. I'd try providing the "na" as the last day of the month but am not sure how to determine this in the code.
- Somehow cause the plot function to "reinitialize" at month beginning. Somehow Pine Script keeps track of the different plot calls and knows which calls map to which existing plot. Probably by variable reference? If I could "reset" the plot method then I could effectively draw a new line and not worry about the vertical transition rendering.
Worth noting: I have a total of 15 lines being plotted any given month.