[英]Plot buy or sell only when candle closes
I am developing a pine script indicator for Tradingview, and I would like some help: is there any code or command to make my plotshape command appear only after the candle closes?我正在为 Tradingview 开发一个 pine 脚本指标,我需要一些帮助:是否有任何代码或命令可以让我的 plotshape 命令仅在蜡烛关闭后出现? This would avoid premeditated signals, which can vary before the candle closes, and end up triggering alerts that can change over the candle's time.
这将避免预谋的信号,这些信号在蜡烛关闭之前可能会发生变化,并最终触发可能随着蜡烛时间而变化的警报。 Thanks!
谢谢!
You can either use the historical operator with your condition and the shape will appear on the opening of the next new bar :您可以将历史运算符与您的条件一起使用,形状将出现在下一个新柱的开口处:
plotshape(my_condition[1])
or you can use barstate.isconfirmed
along with your condition to have the shape rendered on it's own bar, but on the very last update of the bar或者您可以将
barstate.isconfirmed
与您的条件一起使用,以在其自己的栏上呈现形状,但在栏的最后一次更新时
plotshape(my_condition and barstate.isconfirmed)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.