Pine 脚本 - 如何识别最后一根柱的价格
我正在使用Pinescript绘制交易中的支持和阻力框。目前,我绘制的所有盒子都只有一种/相同的颜色。我想将所有盒子标记在当前的询问/投标价格上方,而低于当前的询问/出价价格为绿色。有什么想法吗?
这些是当前绘制框的值。
boxLeft := bar_index-1
boxTop := open[1]
boxBottom := close[1]
boxRight := bar_index +25 // extending the box up to 25 candles from starting position
box.new(boxLeft, boxTop, boxRight, boxBottom, bgcolor=color.rgb(56,79,67,50), border_color=color.rgb(150,200,150,10))
我需要根据当前的询问/投标动态更改bgcolor
,这应该适用于图表上的所有图纸。
I'm drawing support and resistance boxes in TradingView using pinescript. Currently all the boxes that I draw are just of one/same color. I want to mark all boxes above the current ask/bid price as Red and the ones that are below the current ask/bid price as Green. Any ideas?
These are the values for drawing the box currently.
boxLeft := bar_index-1
boxTop := open[1]
boxBottom := close[1]
boxRight := bar_index +25 // extending the box up to 25 candles from starting position
box.new(boxLeft, boxTop, boxRight, boxBottom, bgcolor=color.rgb(56,79,67,50), border_color=color.rgb(150,200,150,10))
I need to dynamically change the bgcolor
based on the current ask/bid, and this should be applicable for all the drawings on the chart.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试以下代码:
you may try with the code below: