将指标的价格值绘制到正确的规模?
我无法在此代码中获得线条以在左标准上显示其价格值。如何将价格值绘制到左规模?感谢您的帮助。 价值的价值
//@version=5
indicator("Lines", overlay=true, scale=scale.left)
base = input.float(title="Base Value", defval=0.7162, step=0.0001)
lineChoice = input.string(title="Buy/Sell", defval = "Buy", options = ["Buy", "Sell", "Buy&Sell"])
if (lineChoice == "Buy")
a = line.new(x1=bar_index, y1=base, x2=bar_index[1], y2=base, extend=extend.both, color=color.aqua, style=line.style_solid, width=1)
b = line.new(x1=bar_index, y1=base * 1.004, x2=bar_index[1], y2=base * 1.004, extend=extend.both, color=color.aqua, style=line.style_dotted, width=1)
c = line.new(x1=bar_index, y1=base * 1.01, x2=bar_index[1], y2=base * 1.01, extend=extend.both, color=color.aqua, style=line.style_dashed, width=1)
d = line.new(x1=bar_index, y1=base * 1.02, x2=bar_index[1], y2=base * 1.02, extend=extend.both, color=color.aqua, style=line.style_dashed, width=1)
e = line.new(x1=bar_index, y1=base * 1.03, x2=bar_index[1], y2=base * 1.03, extend=extend.both, color=color.aqua, style=line.style_dashed, width=1)
else
na
if (lineChoice == "Sell")
f = line.new(x1=bar_index, y1=base, x2=bar_index[1], y2=base, extend=extend.both, color=color.purple, style=line.style_solid, width=1)
g = line.new(x1=bar_index, y1=base * 0.996, x2=bar_index[1], y2=base * 0.996, extend=extend.both, color=color.purple, style=line.style_dotted, width=1)
h = line.new(x1=bar_index, y1=base * 0.99, x2=bar_index[1], y2=base * 0.99, extend=extend.both, color=color.purple, style=line.style_dashed, width=1)
i = line.new(x1=bar_index, y1=base * 0.98, x2=bar_index[1], y2=base * 0.98, extend=extend.both, color=color.purple, style=line.style_dashed, width=1)
j = line.new(x1=bar_index, y1=base * 0.97, x2=bar_index[1], y2=base * 0.97, extend=extend.both, color=color.purple, style=line.style_dashed, width=1)
else
na
if (lineChoice == "Buy&Sell")
a = line.new(x1=bar_index, y1=base, x2=bar_index[1], y2=base, extend=extend.both, color=color.aqua, style=line.style_solid, width=1)
b = line.new(x1=bar_index, y1=base * 1.004, x2=bar_index[1], y2=base * 1.004, extend=extend.both, color=color.aqua, style=line.style_dotted, width=1)
c = line.new(x1=bar_index, y1=base * 1.01, x2=bar_index[1], y2=base * 1.01, extend=extend.both, color=color.aqua, style=line.style_dashed, width=1)
d = line.new(x1=bar_index, y1=base * 1.02, x2=bar_index[1], y2=base * 1.02, extend=extend.both, color=color.aqua, style=line.style_dashed, width=1)
e = line.new(x1=bar_index, y1=base * 1.03, x2=bar_index[1], y2=base * 1.03, extend=extend.both, color=color.aqua, style=line.style_dashed, width=1)
g = line.new(x1=bar_index, y1=base * 0.996, x2=bar_index[1], y2=base * 0.996, extend=extend.both, color=color.purple, style=line.style_dotted, width=1)
h = line.new(x1=bar_index, y1=base * 0.99, x2=bar_index[1], y2=base * 0.99, extend=extend.both, color=color.purple, style=line.style_dashed, width=1)
i = line.new(x1=bar_index, y1=base * 0.98, x2=bar_index[1], y2=base * 0.98, extend=extend.both, color=color.purple, style=line.style_dashed, width=1)
j = line.new(x1=bar_index, y1=base * 0.97, x2=bar_index[1], y2=base * 0.97, extend=extend.both, color=color.purple, style=line.style_dashed, width=1)
else
na
I can't get the lines in this code to show their price values on the left scale. How to plot price values to the left scale? I would appreciate your help. value on a price scale
//@version=5
indicator("Lines", overlay=true, scale=scale.left)
base = input.float(title="Base Value", defval=0.7162, step=0.0001)
lineChoice = input.string(title="Buy/Sell", defval = "Buy", options = ["Buy", "Sell", "Buy&Sell"])
if (lineChoice == "Buy")
a = line.new(x1=bar_index, y1=base, x2=bar_index[1], y2=base, extend=extend.both, color=color.aqua, style=line.style_solid, width=1)
b = line.new(x1=bar_index, y1=base * 1.004, x2=bar_index[1], y2=base * 1.004, extend=extend.both, color=color.aqua, style=line.style_dotted, width=1)
c = line.new(x1=bar_index, y1=base * 1.01, x2=bar_index[1], y2=base * 1.01, extend=extend.both, color=color.aqua, style=line.style_dashed, width=1)
d = line.new(x1=bar_index, y1=base * 1.02, x2=bar_index[1], y2=base * 1.02, extend=extend.both, color=color.aqua, style=line.style_dashed, width=1)
e = line.new(x1=bar_index, y1=base * 1.03, x2=bar_index[1], y2=base * 1.03, extend=extend.both, color=color.aqua, style=line.style_dashed, width=1)
else
na
if (lineChoice == "Sell")
f = line.new(x1=bar_index, y1=base, x2=bar_index[1], y2=base, extend=extend.both, color=color.purple, style=line.style_solid, width=1)
g = line.new(x1=bar_index, y1=base * 0.996, x2=bar_index[1], y2=base * 0.996, extend=extend.both, color=color.purple, style=line.style_dotted, width=1)
h = line.new(x1=bar_index, y1=base * 0.99, x2=bar_index[1], y2=base * 0.99, extend=extend.both, color=color.purple, style=line.style_dashed, width=1)
i = line.new(x1=bar_index, y1=base * 0.98, x2=bar_index[1], y2=base * 0.98, extend=extend.both, color=color.purple, style=line.style_dashed, width=1)
j = line.new(x1=bar_index, y1=base * 0.97, x2=bar_index[1], y2=base * 0.97, extend=extend.both, color=color.purple, style=line.style_dashed, width=1)
else
na
if (lineChoice == "Buy&Sell")
a = line.new(x1=bar_index, y1=base, x2=bar_index[1], y2=base, extend=extend.both, color=color.aqua, style=line.style_solid, width=1)
b = line.new(x1=bar_index, y1=base * 1.004, x2=bar_index[1], y2=base * 1.004, extend=extend.both, color=color.aqua, style=line.style_dotted, width=1)
c = line.new(x1=bar_index, y1=base * 1.01, x2=bar_index[1], y2=base * 1.01, extend=extend.both, color=color.aqua, style=line.style_dashed, width=1)
d = line.new(x1=bar_index, y1=base * 1.02, x2=bar_index[1], y2=base * 1.02, extend=extend.both, color=color.aqua, style=line.style_dashed, width=1)
e = line.new(x1=bar_index, y1=base * 1.03, x2=bar_index[1], y2=base * 1.03, extend=extend.both, color=color.aqua, style=line.style_dashed, width=1)
g = line.new(x1=bar_index, y1=base * 0.996, x2=bar_index[1], y2=base * 0.996, extend=extend.both, color=color.purple, style=line.style_dotted, width=1)
h = line.new(x1=bar_index, y1=base * 0.99, x2=bar_index[1], y2=base * 0.99, extend=extend.both, color=color.purple, style=line.style_dashed, width=1)
i = line.new(x1=bar_index, y1=base * 0.98, x2=bar_index[1], y2=base * 0.98, extend=extend.both, color=color.purple, style=line.style_dashed, width=1)
j = line.new(x1=bar_index, y1=base * 0.97, x2=bar_index[1], y2=base * 0.97, extend=extend.both, color=color.purple, style=line.style_dashed, width=1)
else
na
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无法从line.new()绘制对象上放置标签,仅标记plot()s。
您可以将标准图与TrackPrice =参数一起使用:
There is no way to place a label on the scale from the line.new() drawing objects, only plot()s are labeled.
You can use the standard plots instead with a trackprice= argument: