Definitely count down when closing orders, deleting objects etc.
Generally, I will always count down unless there is a particular reason to count up.
It depends on what you are doing.
As GumRai said, with closing orders etc you should always count down. There is a very good post here explaining why.
If you are working with timeseries (i.e. the bigger the number the older the bar) you may also want to count down to avoid calculations being based on bars that hadn't happened yet. It also makes it easier to avoid array out of range errors IMHO.
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
Hi all
Been searching around the forum looking for references in regard to when to use "for - count down" vs "for - count up" statements.
I use the following code to check open orders in my bot
but because of my very limited skills are unsure of the pros and cons of using counting down vs counting up inside a "for" statement. And for the life of me can't find the threads that I've seen before addressing this.
Can someone please expand on this or if they have them, provide the links to relevant threads.
Many thanks
Bob