删除价格一旦价格越过
问题在于,我不理解我必须执行的命令,直到线与蜡烛相交,
leftLenL = leftLenH
rightLenL = leftLenH
atr1 = ta.atr(10)
atr2 = ta.atr(10)
atr3 = ta.atr(10)
atr4 = ta.atr(10)
atr5 = ta.atr(10)
atr6 = ta.atr(10)
pos1 = close + close * (0.48 /100)
pos2 = close + close * (1.66 /100)
pos3 = close + close * (3.71 /100)
pos4 = close - close * (0.49 /100)
pos5 = close - close * (1.66 /100)
pos6 = close - close * (3.71 /100)
c = ta.pivothigh(leftLenH,rightLenH)
b = ta.pivotlow(leftLenL, rightLenL)
plotshape(c ? pos1: na , "100х Ликвидации Лонг", shape.circle, location.absolute, color.black, 0, "100х Ликвидации", (color.black), size=size.tiny)
plotshape(c ? pos2: na , "50х Ликвилации Лонг", shape.circle, location.absolute, color.black, 0, "50х Ликвидации", (color.black), size=size.tiny)
plotshape(c ? pos3: na , "25х Ликвидации Лонг", shape.circle, location.absolute, color.black, 0, "25х Ликвидации", (color.black), size=size.tiny)
plotshape(b ? pos4: na , "100х Ликвидации Лонг", shape.circle, location.absolute, color.black, 0, "100х Ликвидации", (color.black), size=size.tiny)
plotshape(b ? pos5: na , "50х Ликвилации Лонг", shape.circle, location.absolute, color.black, 0, "50х Ликвидации", (color.black), size=size.tiny)
plotshape(b ? pos6: na , "25х Ликвидации Лонг", shape.circle, location.absolute, color.black, 0, "25х Ликвидации", (color.black), size=size.tiny)
//////Lines//////////
bars = +500
n = 1
var line[] highs = array.new_line() // declare an empty array to store our lines in
var line[] highs2 = array.new_line() // declare an empty array to store our lines in
var line[] highs3 = array.new_line() // declare an empty array to store our lines in
var line[] highs4 = array.new_line() // declare an empty array to store our lines in
var line[] highs5 = array.new_line() // declare an empty array to store our lines in
var line[] highs6 = array.new_line() // declare an empty array to store our lines in
//Lines
bull = b
bear = c
highestHigh = pos1
highestHigh2 = pos2
highestHigh3 = pos3
lowerlow1 = pos4
lowerlow2 = pos5
lowerlow3 = pos6
if bear // instead of just drawing a line, we push it into an array, a list of lines so we can loop through the list and perform actions on all lines
array.unshift(highs, line.new(bar_index, highestHigh, bar_index + bars, highestHigh, style = line.style_dotted, extend=extend.none, color=color.red))
array.unshift(highs2, line.new(bar_index, highestHigh2, bar_index + bars, highestHigh2, style = line.style_dotted, extend=extend.none, color=color.red))
array.unshift(highs3, line.new(bar_index, highestHigh3, bar_index + bars, highestHigh3, style = line.style_dotted, extend=extend.none, color=color.red))
if bull
array.unshift(highs4, line.new(bar_index, lowerlow1, bar_index + bars, lowerlow1,style = line.style_dotted, extend=extend.none, color=color.red))
array.unshift(highs5, line.new(bar_index, lowerlow2, bar_index + bars, lowerlow2,style = line.style_dotted, extend=extend.none, color=color.red))
array.unshift(highs6, line.new(bar_index, lowerlow3, bar_index + bars, lowerlow3,style = line.style_dotted, extend=extend.none, color=color.red))
for x = (array.size(highs) > 0 ? array.size(highs)-1 : na) to 0
line.set_x2(array.get(highs, x), bar_index+bars)
for x2 = (array.size(highs2) > 0 ? array.size(highs2)-1 : na) to 0
line.set_x2(array.get(highs2, x2), bar_index+bars)
for x3 = (array.size(highs3) > 0 ? array.size(highs3)-1 : na) to 0
line.set_x2(array.get(highs3, x3), bar_index+bars)
for x4 = (array.size(highs4) > 0 ? array.size(highs4)-1 : na) to 0
line.set_x2(array.get(highs4, x4), bar_index+bars)
for x5 = (array.size(highs5) > 0 ? array.size(highs5)-1 : na) to 0
line.set_x2(array.get(highs5, x5), bar_index+bars)
for x6 = (array.size(highs6) > 0 ? array.size(highs6)-1 : na) to 0
line.set_x2(array.get(highs6, x6), bar_index+bars)
如果线不相交,则必须继续向右继续直到相交。
我能够通过命令绘制行,
for i2 = (array.size(highs2) > 0 ? array.size(highs2)-1 : na) to 0
但是有了这个命令,我显示了一些行,有些则不显示,我不明白为什么
The problem is that I do not understand what command I have to make the line go until it intersects with a candle
leftLenL = leftLenH
rightLenL = leftLenH
atr1 = ta.atr(10)
atr2 = ta.atr(10)
atr3 = ta.atr(10)
atr4 = ta.atr(10)
atr5 = ta.atr(10)
atr6 = ta.atr(10)
pos1 = close + close * (0.48 /100)
pos2 = close + close * (1.66 /100)
pos3 = close + close * (3.71 /100)
pos4 = close - close * (0.49 /100)
pos5 = close - close * (1.66 /100)
pos6 = close - close * (3.71 /100)
c = ta.pivothigh(leftLenH,rightLenH)
b = ta.pivotlow(leftLenL, rightLenL)
plotshape(c ? pos1: na , "100х Ликвидации Лонг", shape.circle, location.absolute, color.black, 0, "100х Ликвидации", (color.black), size=size.tiny)
plotshape(c ? pos2: na , "50х Ликвилации Лонг", shape.circle, location.absolute, color.black, 0, "50х Ликвидации", (color.black), size=size.tiny)
plotshape(c ? pos3: na , "25х Ликвидации Лонг", shape.circle, location.absolute, color.black, 0, "25х Ликвидации", (color.black), size=size.tiny)
plotshape(b ? pos4: na , "100х Ликвидации Лонг", shape.circle, location.absolute, color.black, 0, "100х Ликвидации", (color.black), size=size.tiny)
plotshape(b ? pos5: na , "50х Ликвилации Лонг", shape.circle, location.absolute, color.black, 0, "50х Ликвидации", (color.black), size=size.tiny)
plotshape(b ? pos6: na , "25х Ликвидации Лонг", shape.circle, location.absolute, color.black, 0, "25х Ликвидации", (color.black), size=size.tiny)
//////Lines//////////
bars = +500
n = 1
var line[] highs = array.new_line() // declare an empty array to store our lines in
var line[] highs2 = array.new_line() // declare an empty array to store our lines in
var line[] highs3 = array.new_line() // declare an empty array to store our lines in
var line[] highs4 = array.new_line() // declare an empty array to store our lines in
var line[] highs5 = array.new_line() // declare an empty array to store our lines in
var line[] highs6 = array.new_line() // declare an empty array to store our lines in
//Lines
bull = b
bear = c
highestHigh = pos1
highestHigh2 = pos2
highestHigh3 = pos3
lowerlow1 = pos4
lowerlow2 = pos5
lowerlow3 = pos6
if bear // instead of just drawing a line, we push it into an array, a list of lines so we can loop through the list and perform actions on all lines
array.unshift(highs, line.new(bar_index, highestHigh, bar_index + bars, highestHigh, style = line.style_dotted, extend=extend.none, color=color.red))
array.unshift(highs2, line.new(bar_index, highestHigh2, bar_index + bars, highestHigh2, style = line.style_dotted, extend=extend.none, color=color.red))
array.unshift(highs3, line.new(bar_index, highestHigh3, bar_index + bars, highestHigh3, style = line.style_dotted, extend=extend.none, color=color.red))
if bull
array.unshift(highs4, line.new(bar_index, lowerlow1, bar_index + bars, lowerlow1,style = line.style_dotted, extend=extend.none, color=color.red))
array.unshift(highs5, line.new(bar_index, lowerlow2, bar_index + bars, lowerlow2,style = line.style_dotted, extend=extend.none, color=color.red))
array.unshift(highs6, line.new(bar_index, lowerlow3, bar_index + bars, lowerlow3,style = line.style_dotted, extend=extend.none, color=color.red))
for x = (array.size(highs) > 0 ? array.size(highs)-1 : na) to 0
line.set_x2(array.get(highs, x), bar_index+bars)
for x2 = (array.size(highs2) > 0 ? array.size(highs2)-1 : na) to 0
line.set_x2(array.get(highs2, x2), bar_index+bars)
for x3 = (array.size(highs3) > 0 ? array.size(highs3)-1 : na) to 0
line.set_x2(array.get(highs3, x3), bar_index+bars)
for x4 = (array.size(highs4) > 0 ? array.size(highs4)-1 : na) to 0
line.set_x2(array.get(highs4, x4), bar_index+bars)
for x5 = (array.size(highs5) > 0 ? array.size(highs5)-1 : na) to 0
line.set_x2(array.get(highs5, x5), bar_index+bars)
for x6 = (array.size(highs6) > 0 ? array.size(highs6)-1 : na) to 0
line.set_x2(array.get(highs6, x6), bar_index+bars)
If the line does not intersect, then it must continue to the right until it intersects.
I was able to draw lines through the command
for i2 = (array.size(highs2) > 0 ? array.size(highs2)-1 : na) to 0
But with this command I had some of the lines displayed and some not, and I don't understand why
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要检查价格是否与线路相交,我们需要循环一系列线以检查每个线路,并在每个栏上进行此操作。枢轴高点在当前价格之上形成 - 我们可以检查这组与Bar High的线路,因为我们知道我们最初将在线以下。枢轴最低始终在低点下形成,因此我们需要按照最初的比例检查针对条低的线条。所以我们有2组; 2个线条。我们可以制作一个函数来扩展行 - 这很容易。我们循环每个数组并正确扩展线路。但是,我们如何排除价格相交的呢?我们需要从数组中删除它们。因此,我们检查每个栏高还是低,以查看它是否损坏了每条线,如果有的话,我们将x2设置为当前条并将其从数组中删除。这样,我们就不会继续扩展它。我已经在以下代码中包括了更多注释:
**注意**最大线计数可以在指示器()标题
欢呼声中调整,并在您的编码和交易中运气最好。
To check if price intersects the lines we need to loop an array of lines to check each against the current bar and do this on each bar. Pivot highs are formed above the current price - we can check this group of lines against bar highs as we know we will be below the line initially. Pivot lows are always formed under the low, so we need to check this group of lines against bar lows as we were above initially. So we have 2 groups; 2 arrays of lines. We can make one function to extend the lines - this is easier. We loop each array and extend the lines right. But how do we exclude ones that price has intersected? We need to remove them from the array. So we check each bar high or low to see if it has broke each line, if it has we set the x2 to the current bar and remove it from the array. This way we do not continue to extend it. I have included further notes in the following code:
** note ** max line count can be adjusted in the indicator() header
Cheers and best of luck with your coding and trading