我正在尝试修改 TradingView 上的 pine 脚本指标,以便它在主图表上指标标题旁边显示指标/图的值。但是,我不想实际绘制任何内容,因为它会扰乱图表的比例。我也不希望它显示在图表上方或下方的单独窗口中。这可以用 Pine 脚本实现吗?
我尝试将 display=display.none 传递给“plot”函数,但这同时删除了值标签和线条。这是代码(图像示例没有“显示”参数):
//@version=4
study(title="ADR %", overlay=true)
length = input(20, title="length")
dhigh = security(syminfo.tickerid, 'D', high)
dlow = security(syminfo.tickerid, 'D', low)
adr = 100 * (sma(dhigh/dlow, length) - 1)
plot(adr, title="ADR %", display=display.none)
Run Code Online (Sandbox Code Playgroud)
使用 tranp=100 的绘图可以工作,但可能会弄乱图表比例。我通常使用绘图字符函数来完成此操作,因为您可以将位置设置为顶部或底部,这样就不会影响比例。只需将字符设置为“”,这样它就不会在图表上放置任何内容。像这样的东西:
plotchar(adr, title="ADR %", char="", location=location.top)
| 归档时间: |
|
| 查看次数: |
9874 次 |
| 最近记录: |