Is OrderSelect() done on global scale?

 

If I use OrderSelect() inside a function to select a certain order by it's #ticket, does it remain selected outside the function as well?

Meaning, can I work with that same order in other functions without having to select it again?

Example:

int MyFunc1() {
   if (OrderSelect(12345,SELECT_BY_TICKET,MODE_TRADES))
   {
      MyFunc2();
   }
return(0);
}

int MyFunc2() {

   // working with the order outside the function
   // where it was first selected
   if (OrderType()==OP_BUY)
   {
      // ... some operations ...
   }

return(0);
}

Thanks!!

 
I have been wondering the same thing . . . knock up some test code and find out. I would but I'm just a little too busy right now . .
 
Yeah I was too lazy to do it, was hoping for a quick answer here on the forums lol :)
 

Okay, just tested it out!

The answer is yes, it is selected on a global scale and can be accessed from any part of the EA once initially selected!

Cheers! :)

 
nanquan:

Okay, just tested it out!

The answer is yes, it is selected on a global scale and can be accessed from any part of the EA once initially selected!

Cheers! :)

Thank you for the confirmation. :-)
 
No problem! :)
Reason: