Because indexing starts at 0, whereas counting starts at 1
So if there are 2 open orders, the first one will be indexed 0 and the 2nd will be indexed 1
So the highest index number will always be 1 less than the total
GumRai:
Hey GumRai thanks for the explanation!!
Because indexing starts at 0, whereas counting starts at 1
So if there are 2 open orders, the first one will be indexed 0 and the 2nd will be indexed 1
So the highest index number will always be 1 less than the total
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hey all, googled for OrderTotal() doc but seems to be missing something.
Have noticed that for looping through open/pending orders, people use for(i=0, i < OrderTotal(), i++) Or for(i=OrderTotal() - 1, i>=0, i--).
Dumb qns but can I check why is it i=OrderTotal() - 1 and not i=OrderTotal() if I want to check if i have any open orders of a particular currency before opening a new trade? (to prevent holding 2 positions of the same currency)