Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k 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 Reply

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...