[英]Add a label at the end of plot line in Pine 4 Tradingview
请让我有点迷路,如果有熟练的程序员可以帮助我,我将不胜感激:
我正在将许多 plot 行输出到新指标 window 中,我需要为它们命名。 这个想法是在每个 plot 行的末尾添加一个 label,显示每个情节线代表的证券的名称(请参阅附带的示例)
知道 Pine4 是否可行吗?
请告诉我
非常感谢!
study("Label?")
Symbol1 = input(title="Sym 1", type=input.symbol, defval="eurusd")
Symbol1close = security(Symbol1, resolution="", expression=close)
Symbol2 = input(title="Sym 2", type=input.symbol, defval="euraud")
Symbol2close = security(Symbol2, resolution="", expression=close)
//the idea would be to add the labels at the end of every single
of these 2 plots. On the labels should appear "eurusd and euraud"
plot(Symbol1close)
plot(Symbol2close)```
[labels on plotlines][1]
[1]: https://i.stack.imgur.com/gvPqS.jpg
你可以尝试这样的事情:
//@version=4
study("Label?")
Symbol1 = input(title="Sym 1", type=input.symbol, defval="eurusd")
Symbol1close = security(Symbol1, resolution="", expression=close)
Symbol2 = input(title="Sym 2", type=input.symbol, defval="euraud")
Symbol2close = security(Symbol2, resolution="", expression=close)
// define label variable persisted between bars, see more about var modifier
// also you can use different label styles as label.style_label_lower_left
var l1 = label.new(bar_index, Symbol1close, Symbol1, style=label.style_label_lower_left)
var l2 = label.new(bar_index, Symbol2close, Symbol2)
// set up new xy params to labels on new bar
label.set_xy(l1, bar_index, Symbol1close)
label.set_xy(l2, bar_index, Symbol2close)
plot(Symbol1close)
plot(Symbol2close)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.