将弹性作为arg将其传递给TradingView的另一个Func的Pinescript
试图将功能作为ARG传递给另一个弹药...
1 //@version=5
2 indicator("My script")
3
4 f1() => 1
5 f2() => f1()
7
8 // accept func as arg
9 f3() => 2
10 f4(func) =>
11 func()
12
13 out1 = f2()
14 out2 = f4(f3)
15
16 if barstate.islastconfirmedhistory
17 label.new(bar_index, high, str.tostring(out1)) // returns 1
18 label.new(bar_index, low, str.tostring(out2)) // returns error (see below)
给出错误: 添加到图表操作失败,原因:第11行:找不到函数或功能引用'func'。
有没有办法实现这一目标?谢谢!
trying to pass a func as an arg to another func...
1 //@version=5
2 indicator("My script")
3
4 f1() => 1
5 f2() => f1()
7
8 // accept func as arg
9 f3() => 2
10 f4(func) =>
11 func()
12
13 out1 = f2()
14 out2 = f4(f3)
15
16 if barstate.islastconfirmedhistory
17 label.new(bar_index, high, str.tostring(out1)) // returns 1
18 label.new(bar_index, low, str.tostring(out2)) // returns error (see below)
gives error:Add to Chart operation failed, reason: line 11: Could not find function or function reference 'func'.
is there a way to accomplish this? thx!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论