Reputation: 25
I have coded a script that takes, price level and then does some calculationson start price in loop and plots horizontal lines.
Currently i have number of lines to 9 with option to increase. I am facing issue when i increase number of lines.
I assume that arrays can hold 100,000 values. (i.e 100,000 values coming from calculations) however when i increase to even 13 it says array too large.
startprice = input.price(0, title = 'Start Price', confirm = true)
pricecycles= input.int(9, title = 'Price Cycles',maxval = 13)
oppsi = input.bool(true,title = "Change Direction",inline = 'direction')
startime = input.time(timestamp("Feb 01 2020 22:10:05"),title = 'start time', confirm = true)
endtme= input.time(timestamp("Feb 01 2020 22:10:05"),title = 'end time', confirm = true)
var float[] priceLevels = array.new_float(0)
for i = 0 to pricecycles
opps = oppsi?(1.618 * 1* i) : (1.618* 1* i) * -1
array.push(priceLevels, (startprice + opps))
for i = 0 to pricecycles
line.new(startime,array.get(priceLevels, i),endtme,array.get(priceLevels, i), xloc = xloc.bar_time, extend = extend.none,color=color.yellow ,width = 1,style = line.style_dotted)
Part of code is given above.
Upvotes: 0
Views: 197
Reputation: 25
ok its fixed.
i just changed this line
var float[] priceLevels = array.new_float(0)
to
priceLevels = array.new_float(0)
Upvotes: 0