Pine script Pine脚本绘制线以连接两条线

Pine script Pine脚本绘制线以连接两条线,pine-script,Pine Script,我有一个从高到低或从低到高的代码,这取决于白天高或低形成的时间。我想有一条连接到个人日的线路。怎么做 study(title="Neely Charts", overlay=true) //Define variables string res = input("D") var float h_price = na var float l_price = na var int h_date = na var int l_d

我有一个从高到低或从低到高的代码,这取决于白天高或低形成的时间。我想有一条连接到个人日的线路。怎么做

study(title="Neely Charts", overlay=true)
//Define variables
string      res = input("D")
var float   h_price = na
var float   l_price = na
var int     h_date = na
var int     l_date = na
var float   h1_price = na
var float   l1_price = na
var int     h1_date = na
var int     l1_date = na



var line z = na
bool isnewtbar = change(time(res)) > 0

//getting lines
if isnewtbar and bar_index > 1 
    h_price := high
    l_price := low
    h_date := time
    l_date := time
   
    z := line.new(x1=h_date, y1=h_price, x2=l_date, y2=l_price, xloc=xloc.bar_time, extend=extend.none, color=color.black, style=line.style_solid, width=2)
    


if high > h_price
    h_price := high
    h_date := time 


if low < l_price
    l_price := low
    l_date := time
  

if h_date <= l_date
    // high to low
    line.set_xy1(id=z, x=h_date, y=h_price)
    line.set_xy2(id=z, x=l_date, y=l_price)
    line.set_color(id=z, color=color.red)
    
else
    // low to high
    line.set_xy1(id=z, x=l_date, y=l_price)
    line.set_xy2(id=z, x=h_date, y=h_price)
    line.set_color(id=z, color=color.lime)
研究(title=“Neely Charts”,overlay=true)
//定义变量
字符串res=输入(“D”)
var浮动h_价格=na
var浮动l_价格=不适用
var int h_date=na
var int l_日期=na
var浮动h1_价格=不适用
var浮动l1_价格=不适用
var int h1_日期=na
变量int l1_日期=na
变量线z=na
bool isnewtbar=change(time(res))>0
//排队
如果isnewtbar和bar_索引>1
h_价格:=高
l_价格:=低
h_日期:=时间
l_日期:=时间
z:=line.new(x1=h_日期,y1=h_价格,x2=l_日期,y2=l_价格,xloc=xloc.bar_时间,extend=extend.none,color=color.black,style=line.style_实心,宽度=2)
如果高>h_价格
h_价格:=高
h_日期:=时间
如果低/@version=4
研究(title=“Neely图表”,叠加=true)
//定义变量
字符串res=输入(“D”)
var浮动h_价格=na
var浮动l_价格=不适用
var int h_date=na
var int l_日期=na
var浮动h1_价格=不适用
var浮动l1_价格=不适用
var int h1_日期=na
变量int l1_日期=na
变量线z=na
var线w=na
bool isnewtbar=change(time(res))>0
//排队
如果isnewtbar和bar_索引>1
h_价格:=高
l_价格:=低
h_日期:=时间
l_日期:=时间
z:=line.new(x1=h_日期,y1=h_价格,x2=l_日期,y2=l_价格,xloc=xloc.bar_时间,extend=extend.none,color=color.black,style=line.style_实心,宽度=2)
w:=line.new(x1=line.get_x2(z[1]),y1=line.get_y2(z[1]),x2=l_日期,y2=l_价格,xloc=xloc.bar_时间,extend=extend.none,color=color.black,style=line.style_solid,width=2)
如果高>h_价格
h_价格:=高
h_日期:=时间
如果低如果你有约会,非常感谢。看来问题解决了。我会画出来的。你已经解决了99%的问题。我会寻求一些帮助。如何在连接器处绘制标记圆。使用函数
plot
和参数
style=plot.style\u circles
。参考应为已尝试但未发生的。它显示了多个情节我想我不明白你的问题。对不起,我使用谷歌翻译。根据网站规则,你必须问下一个问题或去聊天室讨论。我最后一次尝试帮助您,您需要创建两个绘图,一个用于低点,一个用于高点,中间值定义为
na
//@version=4

study(title="Neely Charts", overlay=true)
//Define variables
string      res = input("D")
var float   h_price = na
var float   l_price = na
var int     h_date = na
var int     l_date = na
var float   h1_price = na
var float   l1_price = na
var int     h1_date = na
var int     l1_date = na

var line z = na
var line w = na
bool isnewtbar = change(time(res)) > 0

//getting lines
if isnewtbar and bar_index > 1 
    h_price := high
    l_price := low
    h_date := time
    l_date := time
   
    z := line.new(x1=h_date, y1=h_price, x2=l_date, y2=l_price, xloc=xloc.bar_time, extend=extend.none, color=color.black, style=line.style_solid, width=2)
    w := line.new(x1=line.get_x2(z[1]), y1=line.get_y2(z[1]), x2=l_date, y2=l_price, xloc=xloc.bar_time, extend=extend.none, color=color.black, style=line.style_solid, width=2)
    
if high > h_price
    h_price := high
    h_date := time 


if low < l_price
    l_price := low
    l_date := time
  

if h_date <= l_date
    // high to low
    line.set_xy1(id=z, x=h_date, y=h_price)
    line.set_xy2(id=z, x=l_date, y=l_price)
    line.set_color(id=z, color=color.red)
else
    // low to high
    line.set_xy1(id=z, x=l_date, y=l_price)
    line.set_xy2(id=z, x=h_date, y=h_price)
    line.set_color(id=z, color=color.lime)

line.set_xy2(id=w, x=line.get_x1(z[0]), y=line.get_y1(z[0]))
line.set_color(id=w, color=color.blue)