在写这篇文章之前,我尝试了这里给出的某些想法,但仍然不起作用,所以再次询问。
这是V4代码V2=真SarUp整数//来自此处的代码
get_pltval(V2,sarUp,emaSlow) =>
pltval = 0.0
plval := V2 ? sarUp <= ohlc4 and sarUp[2] > high and sarUp[3] > high and sarUp[4] > high ? 1 : 0 : ohlc4 > emaSlow ? 1 : 0
var _src = 0.0
_src := get_pltval(V2,sarUp,emaSlow)
test = security(syminfo.tickerid, tf, _src, barmerge.gaps_off, barmerge.lookahead_off)
错误不能在安全函数中使用可变变量作为参数
这个问题的任何解决方案。请分享
barmerge
和lookahead
默认为"关闭",因此无需显式定义它们。您可以从security()
:调用函数
//@version=4
study("")
get_pltval(V2,sarUp,emaSlow) =>
pltval = 0.0
plval := V2 ? sarUp <= ohlc4 and sarUp[2] > high and sarUp[3] > high and sarUp[4] > high ? 1 : 0 : ohlc4 > emaSlow ? 1 : 0
test = security(syminfo.tickerid, tf, get_pltval(V2,sarUp,emaSlow))