【问题标题】:Plot name / label in TradingView pine scriptTradingView pine 脚本中的绘图名称/标签
【发布时间】:2021-03-05 09:08:39
【问题描述】:

我怎样才能给情节一个名字/标签? (截图中的红框)

study(title="Average True Range Channels", shorttitle="ATRC", overlay=true)

slowEMAdays = input(22, minval=1, title="Days for EMA", type=integer)
slowEMA = (ema(close, slowEMAdays))
atrBandDays = input(13, minval=1, title="Days for ATR", type=integer)
atrBand = atr(atrBandDays)
atrPlus1 = slowEMA + atrBand
atrPlus2 = slowEMA + atrBand*2
atrPlus3 = slowEMA + atrBand*3
atrMinus1 = slowEMA - atrBand
atrMinus2 = slowEMA - atrBand*2
atrMinus3 = slowEMA - atrBand*3
plot(slowEMA, color=black, linewidth=2)
plot(atrPlus1, color=green)
plot(atrPlus2, color=orange)
plot(atrPlus3, color=red)
plot(atrMinus1, color=green)
plot(atrMinus2, color=orange)
plot(atrMinus3, color=red)

我想为 6 个地块中的一些地块添加警报,但是在添加警报时,我只能看到 6 个具有相同名称(“地块”)的地块,因此我无法轻易将它们彼此区分开 :)

最好, 拉斯穆斯

【问题讨论】:

  • 请张贴代码而不是截图。
  • @BjornMistiaen 忘记添加了。现在添加。谢谢你提醒我。

标签: pine-script


【解决方案1】:

转换为 v4 并标记地块。

//@version=4
study(title="Average True Range Channels", shorttitle="ATRC", overlay=true)

slowEMAdays = input(22, "Days for EMA", type=input.integer, minval=1)
atrBandDays = input(13, "Days for ATR", type=input.integer, minval=1)

slowEMA = ema(close, slowEMAdays)
atrBand = atr(atrBandDays)

atrPlus1    = slowEMA + atrBand
atrPlus2    = slowEMA + atrBand * 2
atrPlus3    = slowEMA + atrBand * 3

atrMinus1   = slowEMA - atrBand
atrMinus2   = slowEMA - atrBand * 2
atrMinus3   = slowEMA - atrBand * 3

plot(slowEMA,   "slowEMA",   color=color.black, linewidth=2)

plot(atrPlus1,  "atrPlus1",  color=color.green)
plot(atrPlus2,  "atrPlus2",  color=color.orange)
plot(atrPlus3,  "atrPlus3",  color=color.red)

plot(atrMinus1, "atrMinus1", color=color.green)
plot(atrMinus2, "atrMinus2", color=color.orange)
plot(atrMinus3, "atrMinus3", color=color.red)

【讨论】:

  • 正是我想要的。非常感谢你! ?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-02-10
  • 1970-01-01
  • 1970-01-01
  • 2020-08-18
  • 1970-01-01
相关资源
最近更新 更多