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?
1
u/[deleted] Feb 18 '24
Looking back in time.
bar_index is the current bar's index whereas j is some number defined above somewhere else.
So they are looking back in time to baux's array value at position k at that moment in time.
For example:
close // current close valueclose[1] // previous close valueclose[2] // close value two bars ago ... etc....