我正在尝试创建一个指标,在那里我想要脚本的当前价格,为此,我想使用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'`
发布于 2020-11-22 00:20:39
像这样使用句点
价格=
(syminfo.tickerid,timeframe.period,src) plot(价格)
price = security(syminfo.tickerid, timeframe.period, src)
plot(价格)
https://stackoverflow.com/questions/64945280
复制相似问题