您可以使用Pinescript中的循环声明变量(专门的线变量)吗?
是否可以通过循环声明线变量?
根据用户输入指定的数字,在表单,line2等上声明多个行变量的指示器,但不确定是否不可能,或者我只是对结构和语法很糟糕。
而不是:
UInput = input.int(n,"User defined input"....
var line1 = line.new(na,na,na,na
var line2 = line.new(na,na,na,na,......
....
var linen = line.new(na,na,na,na,......
n可能是50或更多的想做的事情:
UInput = input.int(n,"User defined input"....
for i = 0 to (n-1)
var linei = line.new(na,na,na,na,......
我尝试使用“行”+str.tostring(i)尝试了一些变体,但不确定如何将其返回为行类型类型。
这是可行的还是单独声明的情况?
Is it possible to declare line variables via a loop?
Working on an indicator in which I would like to declare multiple line variables in the form line1, line2 etc based on a number specified by user input but not sure if it is not possible or I just suck at structure and syntax.
Instead of:
UInput = input.int(n,"User defined input"....
var line1 = line.new(na,na,na,na
var line2 = line.new(na,na,na,na,......
....
var linen = line.new(na,na,na,na,......
As n could be 50 or more would like to do something along the lines of:
UInput = input.int(n,"User defined input"....
for i = 0 to (n-1)
var linei = line.new(na,na,na,na,......
I have tried a few variations using "line"+str.tostring(i) but not sure how to return that as line type instead of string type.
Is this doable or is it a case of declaring individually?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这是可能的。您只需要声明一系列线条,然后将循环中的每条新线推入数组。
Yes, that's possible. You just need to declare an array of lines and push each new line in your loop into your array.