[英]Pinescript: Old scripts with self-referencing variables
我必须使用旧脚本(V2)我只想为自己修改,不要联系任何人来帮助我解决我糟糕的编码技能;)
代码看起来是这样的:
重量 = s(abs(变化(关闭)))
c = 重量 * close + (1-weight) * nz(c[1],close)
(错误来自 c,因为我认为它是一个自引用变量)
在这种情况下,也许有人可以帮助我如何为 pinescript4 声明 c。
感谢优势:)
这可以帮助:
//@version=2
//...
s = nz(s[1]) + close
Compiling this piece of code with Pine version 3 will give you an Undeclared identifier 's' error. It should be rewritten as:
//@version=3
//...
s = 0.0
s := nz(s[1]) + close // ok
你的代码:
//@version=3
study("My script")
weight = abs(change(close))
c = 0.
c := weight * close + (1-weight) * nz(c[1],close)
plot(c)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.