index in the order pool

 
hi guys, i need to find index of selected order in history trades.do u know any function for it?
 
Hakob Meruzhan Gochumyan:
hi guys, i need to find index of selected order in history trades.do u know any function for it?
OrderSelect(…)
 
Daniel Cioca #:
OrderSelect(…)
no , i have the orders ticket, and i want find the index of order in closed orders(history orders)
i want it for for loop
 
Hakob Meruzhan Gochumyan #:
no , i have the orders ticket, and i want find the index of order in closed orders(history orders)
i want it for for loop
Yes, it's OrderSelect(), please read the documentation before saying "no".
 
Alain Verleyen #:
Yes, it's OrderSelect(), please read the documentation before saying "no".
no i selected the order! i want index of selected order 
 
Hakob Meruzhan Gochumyan #no i selected the order! i want index of selected order 

But you already know the "index". It is one of the parameters for the OrderSelect ...

bool  OrderSelect(
   int     index,            // index or order ticket
   int     select,           // flag
   int     pool=MODE_TRADES  // mode
   );
If that is not it, then please explain in more detail and provide example code. We cannot read your mind nor see your computer.
 
Hakob Meruzhan Gochumyan #: no i selected the order! i want index of selected order 

How can you select an order without knowing the index?

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.
     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem

We can't see your broken code.

Always post all relevant code (using Code button) or attach the source file.

 

If you mean that you are selecting an order by ticket number and then wishing to know the index in the order pool, then that is not possible (nor reliable).

This is because you don't know from which pool the ticket is from—the pool of current orders or from the history pool.

Based on whether it is closed or not, you can then loop through the respective pool and find the matching order ticket for the index being selected.

However, the indexing is not reliable as an identifier, because any order closed or deleted will alter the indexing position of the rest of the orders.

Indexing can only be used temporarily. Change the logic of your code so as not to depend on the index.

 
William Roeder #:

How can you select an order without knowing the index?

Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.
     How To Ask Questions The Smart Way. (2004)
          Be precise and informative about your problem

We can't see your broken code.

Always post all relevant code (using Code button) or attach the source file.

only think that you need explained! Fernando get it
 
Fernando Carreiro #:

If you mean that you are selecting an order by ticket number and then wishing to know the index in the order poll, then that is not possible (nor reliable).

This is because you don't know if from which pool the ticket is from—the pool of current orders or from the history pool.

Based on whether it is closed or not, you can then have to loop through the respective pool and find the matching order ticket for the index being selected.

However, the indexing is not reliable as an identifier, because any order closed or deleted will alter the indexing position of the rest of the orders.

Indexing can only be used temporarily. Change the logic of your code so as not to depend on the index.

thank you
Reason: