How to prevent horizontal lines to plot on all instruments

Discussion in 'App Development' started by DevBru, Sep 29, 2020.

  1. DevBru

    DevBru

    I am currently working on an indicator in pinescript that plots horizontal lines on levels of interest, the value of those levels i put in manually each day.

    The issue i currently have is that if for example i want to plot lines on NIO at $20 and $21 and then change the chart to for example TSLA, those same levels from NIO also show on the TSLA chart.

    I need to find a way so the levels from NIO or only plotted on a NIO chart and the levels from TSLA are only plotted on a TSLA chart.

    I don't have much coding experience so i used an existing code as base, here is how it looks:

    Code:
    a1 = input(0, minval=0, type=input.float, title="Horizontal Line 1")
    b1 = input(false, type=input.bool, title="Highlight Line 1?")
    c1 = b1 == true ? color.red : color.yellow
    hline(a1, title="Horizontal Line 1", color=c1, linestyle=hline.style_solid, linewidth=2)
    plot(a1)