【问题标题】:Show higher timeframe indicator on chart在图表上显示更高的时间范围指标
【发布时间】:2019-08-25 13:06:46
【问题描述】:

由于在 v2 脚本下绘制的指标不准确,我正在尝试将一个将较高时间帧指标绘制到较低时间帧图表上的版本 2 脚本转换为 Pinescript 版本 4。

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

第 21 行:无法使用参数调用 plot(series[float]、title=literal string、color=literal color、offset=literal integer、linewidth=literal integer、style=literal string);可用的重载: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整数,字符串)=> 绘图; 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)

【问题讨论】:

    标签: pine-script


    【解决方案1】:

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

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

    style(输入整数)绘图的类型。可能的值是:

    • 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)
    

    【讨论】:

    • 谢谢,解决了我的剧情问题。对于为什么在 4 小时图上,日线与日线图上显示的不同,您有什么建议吗?
    猜你喜欢
    • 2021-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-18
    • 2022-10-15
    • 1970-01-01
    • 2023-02-22
    相关资源
    最近更新 更多