What to use along with OrderSelect? Break, Continue or return?

 

Hello, what should i use along with OrderSelect?


if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) // Ensure order selection is successful
         return;
if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) // Ensure order selection is successful
         break;
if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) // Ensure order selection is successful
         continue;


If am using return; i am getting new warning function must return a value.

 
anuj71:

Hello, what should i use along with OrderSelect?



If am using return; i am getting new warning function must return a value.

OrderSelect is bool so you should return true or false.

 
Rajesh Kumar Nait #:
OrderSelect is bool so you should return true or false.
Even through function is void, double or int?
 
anuj71 #:
Even through function is void, double or int?

for void

return;

for double

return 0.0;

for int

return 0;
 
anuj71 #:
Even through function is void, double or int?
You will have another function which holds OrderSelect(..) like this?

int myfunction(){

If(!OrderSelect{...} return;
}

So that would create an error as the function has to return a number (int)
 
anuj71: what should i use along with OrderSelect?

None of the above. You keep going. Any number of other orders could close in your loop.
          

for(int i=OrdersTotal()-1, i >= 0, --i) if(
   OrderSelect(i, SELECT_BY_POS)
&& OrderMagic() == MagicNumber
&& symbol
){ // do whatever
}