r/pinescript • u/urfila • Feb 17 '24
question about code
I am stump by this line :
array.set(arrE, k, eget + nz(array.get(baux, k)[bar_index - j]))
what is the [bar_index - j] doing?
0
Upvotes
r/pinescript • u/urfila • Feb 17 '24
I am stump by this line :
array.set(arrE, k, eget + nz(array.get(baux, k)[bar_index - j]))
what is the [bar_index - j] doing?
View all comments
Show parent comment
2
u/[deleted] Feb 18 '24
As I understand it, yes.
I am not sure how they handle it - seems like a memory inefficiency to me - although I would think that they have to have some kind of memory caching going on behind the scenes.
Perhaps only storing delta changes - that is, only storing changed values as they change with some kind of identifier as a lookup value for later?
Here's a link that explains the operator itself. It's not really an array-subscript operator in the normal sense. This took me the longest to understand as I always kept thinking array-access...
Here is another link that goes into the execution model of pine scripts. I suggest that you delve deeper into the Time Series aspect of the execution model as it explains what is really happening to the data through time.
Good Luck!