简体   繁体   English

删除除最后一个以外的所有先前的买入卖出信号

[英]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.

相关问题 避免连续买入和卖出信号(我检查了之前所有避免 AA 和 BB 相关的问题,但无法解决我的问题) - Avoiding Consecutive Buy and Sell Signals ( I checked all previous avoiding AA and BB related questions but could not solve my issue) 买入和卖出信号在情节方面因蜡烛而异 - Buy and Sell signals are differing by a candle with respect to plot Pinescript 覆盖不适用于买卖信号 - Pinescript overlay does not work for buy and sell signals Pine Script - 编号买入和卖出信号 - Pine Script - Numbering Buy and Sell signals 根据前一天收盘价买入和卖出的条件 - Condition to buy and sell based on the previous day close 我如何在 TradingView 的 Pine Editor 中将 2 个指标组合成一组“买入”和“卖出”信号? (例如 DeMark9 和 MACD) - How do I combine 2 indicators into one set of 'buy' & 'sell' signals in Pine Editor on TradingView? (DeMark9 & MACD for example) 自上次买入/卖出以来的最高价格 - Max Price since last Buy / Sell 如何忽略连续的买入或卖出信号 - How do I disregard consecutive buy or sell signals 当所有 3 条超级趋势线均为绿色/红色且仅显示一次信号时,如何添加买入/卖出信号? - How can I add a Buy / Sell Signal when all 3 Supertrend lines are green / red and only show the signal one time? Trading View Pine Script:如果蜡烛上已有买入入场,如何不在蜡烛上发送卖出信号? - Trading View Pine Script: How to NOT send sell signals on the candle if there is already a buy entry on this candle?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM