[英]Remove all previous Buy Sell signals except the last one
Is it possible to remove all previous Long and Short signals Except the last one..?是否可以删除除最后一个以外的所有先前的多头和空头信号..? Here is the code这是代码
`long = longCond and CondIni[1] == -1 short = shortCond and CondIni[1] == 1 alertcondition(long, title="Long", message="Long") alertcondition(short, title="Short", message="Short")`
Here what i use after searching on google这是我在谷歌搜索后使用的
`var lastLong = longCond and CondIni[1] == -1 var lastShort = shortCond and CondIni[1] == 1 var long = false var short = false if (lastLong) long := true else if (lastShort) short := true else na`
But it doesn't work.但它不起作用。 and it doesn't even show the ongoing signals.它甚至不显示正在进行的信号。
You cannot remove the shapes created by plotshape()
.您不能删除由plotshape()
创建的形状。
If that is your goal, you should use label
s instead.如果那是您的目标,您应该改用label
。
You would do it by creating a new label whenever your condition is true
and deleting the old one.只要您的条件为true
,您就可以创建一个新的 label 并删除旧的。
// Create a new label
lbl = label.new(bar_index, high, "Buy", yloc=yloc.belowbar, style=label.style_label_up)
// Delete the old label
label.delete(lbl[1]) // Delete the old label
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.