admin管理员组

文章数量:1414614

I have a line in pine script called Total. Now I need to create a line in the opposite direction of the Total line movement. I do not mean -Total. I mean that for example when Total line starts from 0 to 100, at the same time the new line starts from 100 to 0. How can I generally create this line from the first candle on the chart?

I have a line in pine script called Total. Now I need to create a line in the opposite direction of the Total line movement. I do not mean -Total. I mean that for example when Total line starts from 0 to 100, at the same time the new line starts from 100 to 0. How can I generally create this line from the first candle on the chart?

Share Improve this question asked Feb 21 at 2:52 A.GA.G 1372 silver badges12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Just swap the x1 and x2 parameters.

//@version=6
indicator("My script", overlay=true)

left = bar_index
right = bar_index + 100

if (barstate.islast)
    l1 = line.new(x1=left, y1=high, x2=right, y2=low, color=color.green)
    l2 = line.new(x1=right, y1=high, x2=left, y2=low, color=color.red)

本文标签: pine scriptHow to create a line in the opposite direction of another line؟Stack Overflow