在图表上显示更高的时间框架指标

Show higher timeframe indicator on chart

我正在尝试将版本 2 脚本转换为 Pinescript 版本 4,因为在 v2 脚本下绘制的指标不准确。

我在这里使用了其他帖子来尝试解决我的错误,但有一个我无法解决。如下所示

line 21: Cannot call plot with arguments (series[float], title=literal string, color=literal color, offset=literal integer, linewidth=literal integer, style=literal string); available overloads: plot(series[float], const string, series[color], input integer, input integer, input bool, input integer, input float, series[integer], input bool, series[float], const bool, input integer, string) => plot; plot(fun_arg__, const string, fun_arg__, input integer, input integer, input bool, input integer, input float, series[integer], input bool, series[float], const bool, input integer, string) => plot

你能解释一下这个错误信息是什么意思吗?

我已经处理了所有其他错误消息,但我是 pine-script 的新手并且正在努力解决这个问题。 非常感谢您的帮助。

study("Purple Line", overlay=true)
//@version=4

//inputs
useCurrentRes = input(true, title="Use Current Chart Timeframe?")
resCustom = input(title="Use Different Timeframe? Uncheck Box Above", type=input.resolution, defval="D")

teethLength = 8
teethOffset = 5

res = useCurrentRes ? input.resolution : resCustom

smma(src, length) =>
    smma =  0.0
    smma := na(smma[1]) ? sma(src, length) : (smma[1] * (length - 1) + src) / length
    smma

smmaT = smma(hl2, teethLength)

teeth1 = security(syminfo.tickerid, res, smmaT[1], lookahead = barmerge.lookahead_on)
plot(teeth1, title="Teeth", color=#800080, offset=5, linewidth=2, style=line.style_dotted)

阅读文档(关于函数的 Ctrl + Click (PC)Cmd + Click (Mac))。

style plot() 的参数采用以下之一:

style (input integer) 图的类型。可能的值是:

  • plot.style_line,
  • plot.style_stepline,
  • plot.style_histogram,
  • plot.style_cross,
  • plot.style_area,
  • plot.style_columns,
  • plot.style_circles。
  • 默认值为 plot.style_line。

plot() 更改为如下内容:

plot(teeth1, title="Teeth", color=#800080, offset=5, linewidth=2, style=plot.style_line)