【问题标题】:In Trading view I am using plotshape to show buy sell signal how do I add open price in the text在交易视图中,我使用 plotshape 显示买入卖出信号如何在文本中添加开盘价
【发布时间】:2021-02-23 11:05:30
【问题描述】:

我在 tradingview 平台上使用的是第 2 版脚本。我有一个代码显示像这样的买入卖出信号

plotshape(long_final, style=shape.labelup,
          location=location.belowbar, color=green,size=size.tiny,title="buy label",text="Buy",textcolor=white)
plotshape(short_final, style=shape.labeldown,
          location=location.abovebar, color=red,size=size.tiny,title="sell label",text="Sell",textcolor=white)

我需要如何在其中添加 Candle open 值。如果我像下面这样更改,我会收到错误,请您帮忙

plotshape(long_final, style=shape.labelup, location=location.belowbar, color=green,size=size.tiny,title="buy label",text="Buy"+tostring(open),textcolor=white)

【问题讨论】:

    标签: pine-script


    【解决方案1】:

    我已经尝试过和你以前一样的方法,但我做不到。我认为 PineScript 不适合在 plotshape 函数中使用 tostring()。相反,请尝试使用label.new()

    lab= label.new(
                          bar_index, close, 
                          text="Buy"+tostring(open),  
                          color=color.white, 
                          textcolor= color.blue,
                          size= size.auto,
                          style=  label.style_square,
                          yloc= yloc.abovebar)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-17
      • 2013-09-13
      • 1970-01-01
      • 1970-01-01
      • 2022-12-03
      • 1970-01-01
      • 2014-07-21
      相关资源
      最近更新 更多