【问题标题】:Plot future dates绘制未来日期
【发布时间】:2021-12-25 09:37:30
【问题描述】:

我使用直方图为每个特定日期写了一个关于垂直线的 pinescript。

PineScript

//@version=4
study("Plot vertical line with date", overlay=true)
plot((time == timestamp("GMT+0", 2021,11,11,0,0)) ? 100000 : na, color = color.rgb(255, 0, 0, 22), linewidth = 1, title = "Happy 11:11", style =  plot.style_histogram)
plot((time == timestamp("GMT+0", 2022,1,1,0,0)) ? 100000 : na, color = color.rgb(255, 0, 0, 22), linewidth = 1, title = "Happy New Year 2022", style =  plot.style_histogram)

问题

当我使用绘图功能设置未来日期(2022 年 1 月 1 日)时,pinescript 运行成功但未显示在图表中。

【问题讨论】:

    标签: plot pine-script


    【解决方案1】:

    您以后可以使用line.new() 绘制垂直线。此脚本还允许您更改脚本输入中的日期:

    //@version=4
    study("Plot vertical line with date", overlay=true)
    t1 = input(timestamp("2021-11-23T00:00:00+00:00"), "Date", type = input.time)
    if barstate.islast
        line.new(t1, 0, t1, 1, xloc = xloc.bar_time, extend = extend.both)
    

    【讨论】:

      【解决方案2】:

      您无法在未来进行绘图,您需要使用 offset 参数作为解决方法。

      【讨论】:

        猜你喜欢
        • 2016-02-06
        • 2019-12-26
        • 2014-07-03
        • 2019-05-18
        • 1970-01-01
        • 1970-01-01
        • 2016-06-18
        • 2014-01-24
        • 2015-06-03
        相关资源
        最近更新 更多