如何克服松树脚本中的"Compiled script code is too long"



根据Bjorn的回答,尝试在代码中包含更多的数组元素。下面的理论示例包括函数a()中的1000和函数b()中的500。PineScript不能编译这个,因为编译的脚本代码太长:79979。限额是60000。但是,带空格的字符数只有23115个。有什么可以做的包括更多,因为我需要包括4000个元素?

如果排除第49行(from if barstate.islast and syminfo.ticker == "SPY")以下的所有内容,则代码编译为永远不会访问b()。是否有一种方法可以只访问b()如果syminfo的第一个字母。足球比赛" "例如呢?

//@version=4
study("Lines", "LI", true)
var a_ticker = array.new_string()
var a_x1 = array.new_int()
var a_x2 = array.new_int()
var myLine = line.new(na, na, na, na, extend=extend.both)
ai(a,v) => array.includes(a,v)
ax(a,v) => array.indexof(a,v)
as(a,i,v) => array.set(a,i,v)
ag(a,i) => array.get(a,i)
ap(a,v) => array.push(a,v)
f(t,a,b) =>
if ai(a_ticker,t)
i = ax(a_ticker,t),as(a_x1,i,a),as(a_x2,i,b) 
else 
ap(a_ticker,t),ap(a_x1,a),ap(a_x2,b)
a() => 
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6)
b() => 
f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),
f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),
f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),
f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),
f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),
if barstate.islast and syminfo.ticker == "AAPL"
a()
if ai(a_ticker, syminfo.ticker)
idx = ax(a_ticker, syminfo.ticker)
x1  = ag(a_x1, idx)
x2  = ag(a_x2, idx)
line.set_xy1(myLine, bar_index - x1, high[x1])
line.set_xy2(myLine, bar_index - x2, high)
if barstate.islast and syminfo.ticker == "SPY"
b()
if ai(a_ticker, syminfo.ticker)
idx = ax(a_ticker, syminfo.ticker)
x1  = ag(a_x1, idx)
x2  = ag(a_x2, idx)
line.set_xy1(myLine, bar_index - x1, high[x1])
line.set_xy2(myLine, bar_index - x2, high)

编辑1:

基于Bjorn的解决方案,我试图对趋势线的y1和y2价格值使用相同的方法,应该是float(使用价格值),同时保持x1和x2作为趋势线的静态时间戳值。我调整了代码以接受float而不是int,但似乎只接受int。是不是少了什么?float值是否需要函数f_str2int?

//@version=4
study("Lines", "LI", true)
x1_date = timestamp(2020, 10, 30, 9, 30)
x2_date = timestamp(2021, 2, 16, 9, 30)
var string[]    a_ticker            = array.new_string()
var float[]     a_y1                = array.new_float()
var float[]     a_y2                = array.new_float()
var string[]    a_str               = array.new_string()
var string[]    a_digits_str        = array.new_string()
var float[]     a_digits_float      = array.new_float()
var line        myLine              = line.new(x1_date, na, x2_date, na, extend=extend.both, color = color.yellow, xloc = xloc.bar_time)
var string[]    a_str_set_ticker    = array.new_string()
var string[]    a_str_set_y1        = array.new_string()
var string[]    a_str_set_y2        = array.new_string()

// Initializes the a_digits_float array
f_init_digits_float() =>
for x = 0 to 9
array.push(a_digits_str, tostring(x))
array.push(a_digits_float, x)

// Converts a string containing an digit, to an integer
f_digitstr2int(_dstr) => 
array.get(a_digits_float, array.indexof(a_digits_str, _dstr))

// Converts a string containing an integer, to an integer
f_str2int(_s) => 
float multiplier = 1
float number = 0
a = str.split(_s,"")
array.reverse(a)
for x = 0 to array.size(a)-1
digit_str = array.get(a,x)
number := number + multiplier * f_digitstr2int(digit_str)
multiplier := multiplier * 10

number     
// Initialize the data
f_init_data() =>
array.push(a_str_set_ticker, "AAPL,AMZN,SPY")
array.push(a_str_set_y1, "121,3228,322.2")
array.push(a_str_set_y2, "119.1,3210.8,394.9")
if barstate.islast
// Initialization
f_init_digits_float()
f_init_data()
// Process the data
for z = 0 to array.size(a_str_set_ticker)-1
a_ticker := array.concat(str.split(array.get(a_str_set_ticker, z),","), a_ticker)
a_str := str.split(array.get(a_str_set_y1, z),",")
for i = 0 to array.size(a_str)-1
array.push(a_y1,f_str2int(array.get(a_str,i)))
a_str := str.split(array.get(a_str_set_y2, z),",")
for i = 0 to array.size(a_str)-1
array.push(a_y2,f_str2int(array.get(a_str,i)))
// Draw line
if array.includes(a_ticker, syminfo.ticker)
idx = array.indexof(a_ticker, syminfo.ticker)
y1  = array.get(a_y1, idx)
y2  = array.get(a_y2, idx)
line.set_y1(myLine, y1)
line.set_y2(myLine, y2)

编辑2:

基于Bjorn的float方法,我试图为相同的符号绘制3行,但似乎只有第一组数组元素被处理?是否有一种方法可以为相同的符号生成更多的行(基于数据的1、2或最多3行)?相关数组将包括以下内容:

// Initialize the data
f_init_data() =>
// 4000 tickers, broken down into 5 sets, because a string has a max size of 4096 characters.
// 800 tickers, set 1
array.push(a_str_set_ticker, "QQQ,QQQ,QQQ,AMZN,AMZN")
array.push(a_str_set_y1, "267,300,222,3000,2000")
array.push(a_str_set_y2, "338.2,200,111,2500,1000")

显然,它不起作用,因为正如我在上一个问题中评论的那样,编译器在编译时考虑脚本中的所有代码。即使它没有被调用

下面是一个区分符号首字母的例子,但它无法编译,因为总代码库太大了。

//@version=4
study("Lines", "LI", true)
var a_ticker = array.new_string()
var a_x1 = array.new_int()
var a_x2 = array.new_int()
var myLine = line.new(na, na, na, na, extend=extend.both)
ai(a,v) => array.includes(a,v)
ax(a,v) => array.indexof(a,v)
as(a,i,v) => array.set(a,i,v)
ag(a,i) => array.get(a,i)
ap(a,v) => array.push(a,v)
f(t,a,b) =>
if ai(a_ticker,t)
i = ax(a_ticker,t),as(a_x1,i,a),as(a_x2,i,b) 
else 
ap(a_ticker,t),ap(a_x1,a),ap(a_x2,b)
a() => 
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),
f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6),f("AAPL",20,6)
b() => 
f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),
f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),
f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),
f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),
f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6),f("SPY",20,6)
if barstate.islast
first_letter = array.get(str.split(syminfo.ticker, ""),0)
if first_letter == "A"
a()

if first_letter == "S"
b()
if array.size(a_ticker) > 0
if ai(a_ticker, syminfo.ticker)
idx = ax(a_ticker, syminfo.ticker)
x1  = ag(a_x1, idx)
x2  = ag(a_x2, idx)
line.set_xy1(myLine, bar_index - x1, high[x1])
line.set_xy2(myLine, bar_index - x2, high)

恐怕我们必须等到TradingView可以从外部资源读取。

编辑:
我已经设法创建了一个编译的解决方案,同时持有请求的4000个股票。不得不把脚本放在PasteBin上,因为显然StackOverflow上的答案有30K字符的限制。限制无处不在,不只是在Pine:)

Edit2:作为对这个评论的回应。
代码中确实有一个小错误。
array.concat()函数的参数需要切换

a_ticker := array.concat(a_ticker, str.split(array.get(a_str_set_ticker, z),","))

a_ticker := array.concat(str.split(array.get(a_str_set_ticker, z),","), a_ticker)

下面是完整的代码,仅包含示例中的3个报价器。

//@version=4
study("Lines", "LI", true)
var string[]    a_ticker            = array.new_string()
var int[]       a_x1                = array.new_int()
var int[]       a_x2                = array.new_int()
var string[]    a_str               = array.new_string()
var string[]    a_digits_str        = array.new_string()
var int[]       a_digits_int        = array.new_int()
var line        myLine              = line.new(na, na, na, na)//, extend=extend.both)
var string[]    a_str_set_ticker    = array.new_string()
var string[]    a_str_set_x1        = array.new_string()
var string[]    a_str_set_x2        = array.new_string()

// Initializes the a_digits_int array
f_init_digits_int() =>
for x = 0 to 9
array.push(a_digits_str, tostring(x))
array.push(a_digits_int, x)

// Converts a string containing an digit, to an integer
f_digitstr2int(_dstr) => 
array.get(a_digits_int, array.indexof(a_digits_str, _dstr))

// Converts a string containing an integer, to an integer
f_str2int(_s) => 
int multiplier = 1
int number = 0
a = str.split(_s,"")
array.reverse(a)
for x = 0 to array.size(a)-1
digit_str = array.get(a,x)
number := number + multiplier * f_digitstr2int(digit_str)
multiplier := multiplier * 10

number        
// Initialize the data
f_init_data() =>
// 4000 tickers, broken down into 5 sets, because a string has a max size of 4096 characters.
// 800 tickers, set 1
array.push(a_str_set_ticker, "AAPL,AMZN,QQQ")
array.push(a_str_set_x1, "20,30,40")
array.push(a_str_set_x2, "2,3,4")
if barstate.islast
// Initialization
f_init_digits_int()
f_init_data()
// Process the data
for z = 0 to array.size(a_str_set_ticker)-1
a_ticker := array.concat(str.split(array.get(a_str_set_ticker, z),","), a_ticker)
a_str := str.split(array.get(a_str_set_x1, z),",")
for i = 0 to array.size(a_str)-1
array.push(a_x1,f_str2int(array.get(a_str,i)))
a_str := str.split(array.get(a_str_set_x2, z),",")
for i = 0 to array.size(a_str)-1
array.push(a_x2,f_str2int(array.get(a_str,i)))
// Draw line
if array.includes(a_ticker, syminfo.ticker)
idx = array.indexof(a_ticker, syminfo.ticker)
x1  = array.get(a_x1, idx)
x2  = array.get(a_x2, idx)
line.set_xy1(myLine, bar_index - x1, high[x1])
line.set_xy2(myLine, bar_index - x2, high)

PasteBin上的脚本也已经更新。

回复你的编辑
无法更新我原来的答案,因为30K字符的限制,所以不得不发布一个新的答案。

增加了y值的f_str2float()
示例脚本:

//@version=4
study("Lines", "LI", true)
var string[]    a_ticker            = array.new_string()
var int[]       a_x1                = array.new_int()
var int[]       a_x2                = array.new_int()
var float[]     a_y1                = array.new_float()
var float[]     a_y2                = array.new_float()
var string[]    a_str               = array.new_string()
var string[]    a_digits_str        = array.new_string()
var int[]       a_digits_int        = array.new_int()
var line        myLine              = line.new(na, na, na, na)//, extend=extend.both)
var string[]    a_str_set_ticker    = array.new_string()
var string[]    a_str_set_x1        = array.new_string()
var string[]    a_str_set_x2        = array.new_string()
var string[]    a_str_set_y1        = array.new_string()
var string[]    a_str_set_y2        = array.new_string()

// Initializes the a_digits_int array
f_init_digits_int() =>
for x = 0 to 9
array.push(a_digits_str, tostring(x))
array.push(a_digits_int, x)
// Converts a string containing a digit, to an integer
f_digitstr2int(_dstr) => 
array.get(a_digits_int, array.indexof(a_digits_str, _dstr))
// Converts a string containing an integer, to an integer
f_str2int(_s) => 
int multiplier = 1
int number = 0
// Initialize the a_digits_int array in case it hasn't been done yet.
if not array.size(a_digits_int) 
f_init_digits_int() 

a = str.split(_s,"")
array.reverse(a)
for x = 0 to array.size(a)-1
digit_str = array.get(a,x)
number := number + multiplier * f_digitstr2int(digit_str)
multiplier := multiplier * 10

number        
// Converts a string containing a float, to a float
f_str2float(_s) =>
float   number          = na
string  s_absolute      = str.replace_all(_s,"-","")
bool    is_negative     = str.length(s_absolute) != str.length(_s)

a_split = str.split(s_absolute,".")
if array.size(a_split) > 1 // _s has a decimal separator
number := f_str2int(array.get(a_split,0)) + f_str2int(array.get(a_split,1)) / pow(10,str.length(array.get(a_split,1)))
else // _s does not have a decimal separator, so it's an integer
number := f_str2int(_s)

number * (is_negative ? -1 : 1)
// Initialize the data
f_init_data() =>
// 4000 tickers, broken down into 5 sets, because a string has a max size of 4096 characters.
// 800 tickers, set 1
array.push(a_str_set_ticker, "AAPL,AMZN,QQQ")
array.push(a_str_set_x1, "20,30,40")
array.push(a_str_set_x2, "2,3,4")
array.push(a_str_set_y1, "100.22,3000.33,300.44")
array.push(a_str_set_y2, "140.22,3500.33,350.44")
if barstate.islast
// Initialization
f_init_data()
// Process the data
for z = 0 to array.size(a_str_set_ticker)-1
a_ticker := array.concat(str.split(array.get(a_str_set_ticker, z),","), a_ticker)
a_str := str.split(array.get(a_str_set_x1, z),",")
for i = 0 to array.size(a_str)-1
array.push(a_x1,f_str2int(array.get(a_str,i)))
a_str := str.split(array.get(a_str_set_x2, z),",")
for i = 0 to array.size(a_str)-1
array.push(a_x2,f_str2int(array.get(a_str,i)))
a_str := str.split(array.get(a_str_set_y1, z),",")
for i = 0 to array.size(a_str)-1
array.push(a_y1,f_str2float(array.get(a_str,i)))
a_str := str.split(array.get(a_str_set_y2, z),",")
for i = 0 to array.size(a_str)-1
array.push(a_y2,f_str2float(array.get(a_str,i)))
// Draw line
if array.includes(a_ticker, syminfo.ticker)
idx = array.indexof(a_ticker, syminfo.ticker)
x1  = array.get(a_x1, idx)
x2  = array.get(a_x2, idx)
y1  = array.get(a_y1, idx)
y2  = array.get(a_y2, idx)
line.set_xy1(myLine, bar_index - x1, y1)
line.set_xy2(myLine, bar_index - x2, y2)

相关内容

  • 没有找到相关文章

最新更新