Reputation: 1
just like the code below, I was trying to get the lower timeframe data from 1 minute timeframe, but I got the error message:
In 'array.get()' function. Index 1 is out of bounds. array size is 0.
plot(array.get(request.security_lower_tf(syminfo.tickerid, '1', close), 1))
But if I change the code to get the array size, I can get the correct lower timeframe array size in the present timeframe, like if the present timeframe is 1 hour, I got the array size 60 , if 4 hours, I got 240.
plot(array.size(request.security_lower_tf(syminfo.tickerid, '1', close)))
And I noticed if the present timeframe is 1 minute , I got another error message(I set the index to 1 to find out if there is any array element.):
In 'array.get()' function. Index 1 is out of bounds. array size is 1.
If I understand correctly, 'request.security_lower_tf ' can and can only be used to get the lower timeframe data.
Why is this happening? What should I do to get the correct data?
Upvotes: 0
Views: 1932
Reputation: 1368
So use it like
arr=request.security_lower_tf(syminfo.tickerid, '1', close)
plot(array.size(arr)>0?array.get(arr,0):na)
Upvotes: 1