【问题标题】:Pine Editor not compiling ta.sma() even though syntax correct即使语法正确,Pine Editor 也不编译 ta.sma()
【发布时间】:2022-08-11 19:09:27
【问题描述】:

我只是想用内置简单移动平均函数的值来分配我的变量 (movingAv)。但是,对于上面带有我的变量声明的行,我收到错误“找不到函数或函数引用 ta.sma”。

在代码编辑器中,“ta.sma”已变为蓝色,因此编辑器必须识别该功能。我从其他指标中查看了类似的代码,它看起来是一样的。

任何想法这里发生了什么?

非常感谢 亚当

study(\"Renko Reversal alert\", overlay=true) 

src = close
len = 10
movingAv = ta.sma(src, len)
plot(movingAv, color=color.blue, title=\"MA\")

//Buy signal if a bearish renko brick is followed by a bullish brick
//Sell signal if a bullish brick is followed by a bearish brick
long = close[1] > open[1] and close[2] < open[2]
long = close[1] < open[1] and close[2] > open[2]
longCross = open[1] < movingAv and close[1] > movingAv
shortCross = open[1] > movingAv and close[1] < movingAv

//Use these alerts to create server-side alerts (right-click on one of the buy or sell arrows on the chart and choose \"add alert\")
alertcondition(long == true, title = \'Long opportunity\', message = \'{{ticker}}\')
alertcondition(short == true, title = \'Short opportunity\', message = \'{{ticker}}\')
alertcondition(longCross == true, title = \'Long SMA XOver\', message = \'{{ticker}}\')
alertcondition(longCross == true, title = \'Short SMA Xover\', message = \'{{ticker}}\')

//Use this to customize the look of the arrows to suit your needs.
plotshape(long, location=location.belowbar, color=lime, style=shape.arrowup, text=\"Buy\")
plotshape(short, location=location.abovebar, color=red, style=shape.arrowdown, text=\"Sell\")
plotshape(longCross, location=location.belowbar, color=lime, style=shape.arrowup, text=\"Buy\")
plotshape(shorCross, location=location.abovebar, color=red, style=shape.arrowdown, text=\"Sell\")

    标签: pine-script


    【解决方案1】:

    您是否在脚本的第一行添加了以下内容?

    //@version=5

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-18
      • 2022-09-23
      • 2022-11-14
      • 2016-06-15
      • 1970-01-01
      相关资源
      最近更新 更多