How do you call a function from within a second function? Online help is not cutting it - page 3
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
Ok... so I want to confirm that I understand what you're saying... for example if the pool size is 10 and your index is on 8, but 5 orders get deleted which shrink the pool to 5, OrderSelect(8,..) would return false despite orders still in the pool.
I rarely use the standard way of looping orders and use a library that loops and adds ticket numbers of orders that match criteria to a collection... and then loop the collection, selecting by ticket numbers for processing... I have seen the error in my ways.
Ok... so I want to confirm that I understand what you're saying... for example if the pool size is 10 and your index is on 8, but 5 orders get deleted which shrink the pool to 5, OrderSelect(8,..) would return false despite orders still in the pool.
I rarely use the standard way of looping orders and use a library that loops and adds ticket numbers of orders that match criteria to a collection... and then loop the collection, selecting by ticket numbers for processing... I have seen the error in my ways.
Now that I think of it, the same could apply the other way as well, no? Say you add 5 tickets in the middle of a std for(int i = Orderstotal()-1;i>=0;i--) loop it could push orders you need to process outside of your loop scope. So I suppose the only fail-safe way to go about it is to add the ticket numbers you want to process to a collection and then go about processing them by ticket and not by position!
What that does is process the list n times, once to get the ticket numbers, and then again for each ticket. Not wrong, just inefficient. I do it that way also, if I need to process them in a specific way. The OrderSelect loop down just processes them newest first, (non-fifo #16.)
...
...
I am not sure what is at stake in this discussion? I don't think you can find a general rule, it all depends of the context.
So there is no generic solution equally efficient for all cases, both of your implementations are correct, in a given context, incorrect in other(s).