不能使用可变变量作为安全函数的参数

Cannot use a mutable variable as an argument of the security function

下面的脚本无法编译。
它抛出错误 Cannot use a mutable variable as an argument of the security function
我不明白为什么。
我在安全函数中使用的参数不是可变变量。
当我注释掉行 h := h * 3 时,脚本编译正常。
有人知道这里发生了什么吗?
这可能是 Pine 脚本错误吗?

//@version=4
study("My Script")

[h, l, c] = security(syminfo.ticker, "D", [high,low,close], lookahead = barmerge.lookahead_on) // actual daily high,low,close.
h := h * 3 // Commenting this line results removes the error: "Cannot use a mutable variable as an argument of the security function."

plot(h)

出于某种原因,当 user-defined 函数 returns 与 security() 函数时,解构赋值的处理方式不同。将您的 security() 调用封装在函数中将起作用:

//@version=4
study("")
f_sec() => security(syminfo.tickerid, "D", [high,low,close], lookahead = barmerge.lookahead_on)
[h, l, c] = f_sec()
h := h * 3
plot(h)

请注意,您在使用前瞻时使用的是历史柱上的未来数据,而不是像您在那里所做的那样将系列偏移 1。