Download MetaTrader 5
To add comments, please log in or register
Share your programs. That will improve your rating.
Marcos Silva
305
Marcos Silva 2013.11.28 04:51 

Hi,

Im a little bit confused with the ticket number for the order remaining, i have been doing tests and the order closed partially is the one with the ticket number already assigned with the beginning lots so whats the number for the lots left?

Ex:

I open an order with 1 lot and get ticket number 11.

I close order 11 using only 0.6 lots.

What is the ticket number for the remaining 0.4 lots?

Is that a way for me to know that number when i close order 11?

Ian Flanagan
549
Ian Flanagan 2013.11.28 05:08  

Good question. My broker shows it in the common of the order, I guess maybe you can't rely on that though.

One way is give each order a unique magic number or comment.

Another way to try is search all open orders for the correct ticket number, store it's position, then get the ticket number of the same position after partially closing. Just don't open or close other orders in the mean time. I don't know if partially closing changes to order position, maybe if it sticks the order at the end, it will make it easier

Marcos Silva
305
Marcos Silva 2013.11.28 11:18  
whroeder1
13641
whroeder1 2013.11.28 13:00  
investguy:
so whats the number for the lots left?
What is the ticket number for the remaining 0.4 lots?
Is that a way for me to know that number when i close order 11?
  1. New = Original - Close. DUH
  2. Assigned by the broker just like the original. DUH
  3. OrderSelect loop (counting down) and find the new one.
GreenMoney
379
GreenMoney 2013.11.28 13:38  
investguy:

Hi,

Im a little bit confused with the ticket number for the order remaining, i have been doing tests and the order closed partially is the one with the ticket number already assigned with the beginning lots so whats the number for the lots left?

Ex:

I open an order with 1 lot and get ticket number 11.

I close order 11 using only 0.6 lots.

What is the ticket number for the remaining 0.4 lots?

Is that a way for me to know that number when i close order 11?

This code may help you some. It is an example function which partially closes an open order and returns the ticket number of the newly created order.
Marcos Silva
305
Marcos Silva 2013.11.28 18:08  
Great help indeed thank you guys !
/
To add comments, please log in or register