Hide connection of plot Lines (TradingView|PineScript)

Remove Connections line from horizontal plots

In PineScript there seems no built-in way (by 2019) to turn on-off the line connections (when the line’s values changes). It can be achieved if you change the plot style to circles, but not all people like circles, and instead they might want straight horizontal lines.

For that, there exists a “trick” to achieve that. For example, use:

myHigh = highest(high,5) 
plot( myHigh, style=plot.style_linebr, color=( myHigh!=myHigh[1]? #eeeeee00 : color.red) )

and you will get the horizontal lines. 
If you want to see that first bar of the connection part too, then you might add the 2nd plot too to only plot the first bar:

plot(myHigh, style=plot.style_circles, color=( myHigh!=myHigh[1] and myHigh[1]!=myHigh[2]? color.red : #eeeeee00 ), offset=-1)

That’s all for now.  

(btw, in rare cases there exists other workaround too, i.e. to hide one plot, and show another, like:

plot(condition ? high : na, .....
plot(condition ? na : high, .....

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *