Pinescript情节问题
当我的职位“ pos”为= -1(卖出)或位置为= 1(买)时,我需要编辑代码以绘制买入/出售信号位置从红色更改为绿色,反之亦然,请注意:我的pinescript版本是v1,
color = pos == -1 ? red: pos == 1 ? green : blue
plotshape(color , title="Buy", style=shape.labelup, location=location.belowbar, size=size.normal, text="Buy", transp=0, textcolor = white, color=green, transp=0)
plotshape(color , title="Sell", style=shape.labeldown, location=location.abovebar, size=size.normal, text="Sell", transp=0, textcolor = white, color=red, transp=0)
I need to edit my code to plot a buy/sell signal when my position "pos" is =-1 (sell) or the position is = 1 (buy) but the problem is plotting several times I need to plot only every time the position is changed from red to green or vise versa, Note: My Pinescript version is v1,
color = pos == -1 ? red: pos == 1 ? green : blue
plotshape(color , title="Buy", style=shape.labelup, location=location.belowbar, size=size.normal, text="Buy", transp=0, textcolor = white, color=green, transp=0)
plotshape(color , title="Sell", style=shape.labeldown, location=location.abovebar, size=size.normal, text="Sell", transp=0, textcolor = white, color=red, transp=0)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,找出位置是否在当前栏上更改。
然后使用这些变量来绘制形状。
First, find out if the position changed on the current bar.
Then use these variables to plot your shape.