I searched the database and documentation but haven't found the specific information on this.
I've been having troubles with selecting orders. So in a number of different programs I put in print or alert statements after them to return the error status of them. All of them with the int pool=MODE_TRADES method.
They all return 0 (zero) which I thought was the Boolean 'false' status; but it seems unlikely as all the instances in different EAs all return 'zero'.
Some functions use -1 as a 'false' status. I would appreciate definitive answer on this matter.
If it does turn out to be that 'zero' is indeed 'false' then I have significant problems with not selecting the orders as is required. though I find it hard to elieve that this is the case because SOME of them work just fine in the strategy tester.
OrderSelect() returns bool type, which means 0 or 1 (https://docs.mql4.com/basis/types/bool). Functions that use -1 as a 'false' status, do not return bool, they return int (hence choosing -1 as false is a matter of semantics).
In this case the return of zero means selection failed. Post your code if u can't find the problem.
for(int index = OrdersTotal() - 1; index >= 0; index--) if ( OrderSelect(index, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == MagicNumber // my magic number && OrderSymbol() == Symbol() ) { // and period and symbol // process... }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I searched the database and documentation but haven't found the specific information on this.
I've been having troubles with selecting orders. So in a number of different programs I put in print or alert statements after them to return the error status. All of them are being selected with the int pool=MODE_TRADES method.
They all return 0 (zero) which I thought was the Boolean 'false' status? But it seems unlikely as ALL the instances in different EAs all return 'zero'.
I believe that some functions use -1 as a 'false' status?
I would appreciate definitive answer on this matter.
If it does turn out to be that 'zero' is indeed 'false' then I have significant problems with not selecting the orders as is required. Though I find it hard to believe that this is the case as they are all erturning zero and SOME of them work just fine in the strategy tester.