what is "SELECT_BY_POS " in OrderSelect()??

To add comments, please log in or register
jilongl
118
jilongl  

I know what is "SELECT_BY_TICKET" in OrderSelect(), but how about "SELECT_BY_POS "??? thanks for your help

Alexander
2441
Alexander  

Why don't you read the Book?

https://book.mql4.com/trading/orderclose

jilongl
118
jilongl  
Roger:

Why don't you read the Book?

https://book.mql4.com/trading/orderclose


i did read this,but i could not understand. it said "SELECT_BY_POS - in the parameter 'index', the order number in the list is returned (the numbering starts with 0)",

but what is order number in the list? what list??

Alexander
2441
Alexander  
When you open market or pending order, it goes to the pool and has its own number in pool. If it's one order, it has number 0. Next opened order has number 1. If you close order number 0, next order becomes number 0. You can always know how many orders are in the pool with function OrdersTotal(), but you don't know what type of order it is, if don't check every with function OrderSelect().
William Roeder
20210
William Roeder  
To find your EA's order, use
    for(pos = OrdersTotal()-1; pos >= 0 ; pos--) if (
        OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
    &&  OrderMagicNumber()  == magic.number             // my magic number
    &&  OrderSymbol()       == Symbol()                 // and my pair.
    ){
      ...
Nivaldo Georg Junior
48
Nivaldo Georg Junior  
whroeder1:
To find your EA's order, use

sorry, i'm programming this 4 months now, and i don't get it.

what is the value returned on the OrderSelect function? and what do i do when i have more orders?


i'm really trying but this is becoming noisy to me. 

thanks in advance.

To add comments, please log in or register