To display a moving average or other price study line which intermittently starts and ends per formula conditions (not a continuous line), how is a for loop used to display the line on a chart?
The problem I'm finding with the display of an intermttently appearing study line is that when a line end point is reached (<LineCondition> == false) and then later a new start point is reached (<LineCondition>==true), and both points are in the visible chart area, an extraneous straight line appears that connects the last visible line end point with the new line start point. When either one or the other end or start points scroll off the visible chart area, the extraneous connecting line disappears, leaving the desired gap between last end point and new start point.
How to keep those unwanted connecting lines from appearing? Is a for loop the answer; used with drawLineRelative? How is that code written? Are there alternate solutions?
The problem I'm finding with the display of an intermttently appearing study line is that when a line end point is reached (<LineCondition> == false) and then later a new start point is reached (<LineCondition>==true), and both points are in the visible chart area, an extraneous straight line appears that connects the last visible line end point with the new line start point. When either one or the other end or start points scroll off the visible chart area, the extraneous connecting line disappears, leaving the desired gap between last end point and new start point.
How to keep those unwanted connecting lines from appearing? Is a for loop the answer; used with drawLineRelative? How is that code written? Are there alternate solutions?
Comment