Try to learn the concept of an array.
PositionTotals() is the size of an array, for loop of "i" is an index and index start with 0 instead of 1.
for example, an array of [a, b, c, d, e, f] has total size of 6 (PositionsTotal() = 6). So if you want to count backward in that array, you start with index of 5 (6 minus 1).
because [ a (index is 0), b (index is 1), c (index is 2), d (index is 3), e (index is 4), f (index is 5)]
Try to learn the concept of an array.
PositionTotals() is the size of an array, for loop of "i" is an index and index start with 0 instead of 1.
for example, an array of [a, b, c, d, e, f] has total size of 6 (PositionsTotal() = 6). So if you want to count backward in that array, you start with index of 5 (6 minus 1).
because [ a (index is 0), b (index is 1), c (index is 2), d (index is 3), e (index is 4), f (index is 5)]
I was sure i'm missing out an important concept, thank you!
Try to learn the concept of an array.
PositionTotals() is the size of an array, for loop of "i" is an index and index start with 0 instead of 1.
for example, an array of [a, b, c, d, e, f] has total size of 6 (PositionsTotal() = 6). So if you want to count backward in that array, you start with index of 5 (6 minus 1).
because [ a (index is 0), b (index is 1), c (index is 2), d (index is 3), e (index is 4), f (index is 5)]
Wait, by using the same logic why does PositionsTotal()==0 means no open positions, in an array of [a,b,c,d,e,f] it should be selecting [a] which means there is 1 open position
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
What's the purpose of adding -1, why couldn't it just be