OrderSelect scope issue

 

Hi All, 


I am trying to do the following code:


for(int z=0;z < OrdersTotal();z++) {

      if(OrderSelect(z,SELECT_BY_POS,MODE_TRADES)==true) {

        ....

        int another_function = another_function(....)

and then the another_function is defined by:


int another_function(...) {

for(int z=0;z < OrdersTotal();z++) {

      if(OrderSelect(z,SELECT_BY_POS,MODE_TRADES)==true) {
....
return 1



The issue i am getting is that one the "another_function" is called which loops through the order again, once the control comes back to main loop a different order has been selected. So this a known issue? if yes is there anyway to limit the scope of "OrderSelect" to local only?

Reason: