Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.7k views
in Technique[技术] by (71.8m points)

trading - Tradingview Pine Script Line Draw

I am writing my own script which will draw key level lines on chart. For an example below code will draw couple of lines on individual ticker..

study("Multi Horizontal Lines", overlay=true)

toadd = 0.
incval = 0.
selectedprice = 0.

selectedprice := input(title="Type Your Start Price Here", type=input.float, defval=9500.0)
incval := input(title="Increment Value", type=input.float, defval=540.0)
toadd := incval


line.new(bar_index, selectedprice, bar_index[100], selectedprice, width = 1, color=color.white)
for i = 1 to 10
    line.new(bar_index, selectedprice+(toadd*i), bar_index[100], selectedprice+(toadd*i), width = 1, color=color.green, style=line.style_dashed)
    
    line.new(bar_index, selectedprice-(toadd*i), bar_index[100], selectedprice-(toadd*i), width = 1, color=color.red, style=line.style_dashed)

If I draw those lines on AAPL chart and if I selcet TSLA chart, same lines which i draw on AAPL is appearing on TSLA chart. I need to draw lines on bunch of charts and I would like to automate this. is there any other alternate ?

Thanks


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...