【问题标题】:why tradingview pine editor showing this error "Undeclared identifier 'period'"为什么 tradingview pine 编辑器显示此错误“未声明的标识符'句号'”
【发布时间】:2020-11-21 16:16:10
【问题描述】:

我正在尝试创建一个我想要脚本当前价格的指标,为此,我想使用 tickerid 和 security() 这是我的代码

// © Tiger2dec

//@version=4
strategy("suresh banknifty", overlay=true)
src = input(close, title="Source")
// current volume 
cvolume= volume

//vwap
close1=close
vwap1=vwap(close1)
plot(vwap1)

//rsi
rsi=rsi(close,14)

//current price
price = security(syminfo.tickerid, period, src)

longCondition = cvolume>50000 and rsi>50
if (longCondition)
    strategy.entry("My Long Entry Id", strategy.long)

shortCondition = crossunder(sma(close, 14), sma(close, 28))
if (shortCondition)
    strategy.entry("My Short Entry Id", strategy.short)```


but its showing error  `Save operation failed, reason: line 19: Undeclared identifier 'period'`

【问题讨论】:

    标签: editor indicator tradingview-api


    【解决方案1】:

    像这样使用句号

    price = security(syminfo.tickerid, timeframe.period, src) 地块(价格)

    price = security(syminfo.tickerid, timeframe.period, src)
    

    地块(价格)

    【讨论】:

      猜你喜欢
      • 2020-07-22
      • 2023-02-11
      • 2022-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-17
      • 1970-01-01
      • 2021-03-18
      相关资源
      最近更新 更多