Download MetaTrader 5

OrderSelect and OrderOpenPrice(); doesn't return open price for all position

To add comments, please log in or register
Schopenhauer
39
Schopenhauer  
doesn't return open price for all position, it is only give me the price for first position,
what can i do for make it give me open price for all position which Ticket (1)
I hope it's clear
if(OrderSelect(1,SELECT_BY_TICKET)==true)_OOP_1 = OrderOpenPrice();
SYED NAUFAL GADDAFI
1399
SYED NAUFAL GADDAFI  
You need to use loop and I see no loop is used here.
Schopenhauer
39
Schopenhauer  
thanks . just give me example 
Simon Gniadkowski
Moderator
18036
Simon Gniadkowski  
Schopenhauer:
thanks . just give me example 
Loops and Closing or Deleting Orders
Schopenhauer
39
Schopenhauer  
   for (int i=1; i<=OrdersTotal(); i++)       //Cycle for all orders..
     {                                        //displayed in the terminal
      if(OrderSelect(i-1,SELECT_BY_POS)==true)//If there is the next one
       
     }      
if(OrderSelect(1,SELECT_BY_TICKET)==true)_OOP_1 = OrderOpenPrice();

How can I get OpenPrice result with this Loop

to get always last order (1) result  

!!! 

Schopenhauer
39
Schopenhauer  
ANY ONE CAN HELP ME
Keith Watford
Moderator
10615
Keith Watford  
If you explained clearly what you want, then maybe somebody will be able to help you.
ffoorr
1108
ffoorr  

 look into the documentation the way to use Array


 double OOP[30];

  
 for (int i=0; i<OrdersTotal(); i++)       
     {                                       
      if(OrderSelect(i,SELECT_BY_POS)==true) OOP[i] = OrderOpenPrice();
       
     }   
To add comments, please log in or register