【发布时间】: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