如何在松树脚本中的特定日期上打印指示符(三角形)

时间:2019-12-07 00:02:02

标签: pine-script indicator

我正在尝试在松树脚本中的3个特定日期打印三角形形状。我无法在以下任何日期打印形状。

    //@version=4`
    study(title = "Mercury Pivot", shorttitle="Mercury Pivot", overlay =true)`

    //These are the dates which i want the Triangle to be printed below 
    t1 = timestamp(2017, 11, 1, 0, 0) // 1st of November 2017
    t2 = timestamp(2018, 11, 1, 0, 0) // 1st of November 2018
    t3 = timestamp(2019, 11, 1, 0, 0) // 1st of November 2019

    //If the time is equal to the above date, print/display a triangle below the date with the text 
    "pivot"
    if time = t1
    plotshape(style=shape.triangleup, location=location.belowbar, text="PIVOT")

    if time = t2 
    plotshape(style=shape.triangleup, location=location.belowbar, text="PIVOT")

    if time = t3 
    plotshape(style=shape.triangleup, location=location.belowbar, text="PIVOT")

1 个答案:

答案 0 :(得分:2)

  1. 使用内置日期更为可靠。请参阅此代码中的替代方法,并绘制仅显示那些标记的图表。
  2. 您不能从$str = preg_replace('/[\r\n]+/', '~', $_POST['msg']); // assuming your textarea has a `name` of `msg` echo $str; // Hello, ~I am Matt 块内部进行绘图。需要包括条件 在您的if电话中。
plotshape()

enter image description here