Download MetaTrader 5
To add comments, please log in or register
Publish your trading signal. Gain access to millions of traders!
Tradeing Trader
556
Tradeing Trader 2014.04.24 07:16 

Hello,

i wanted to code a partial close and i wanted to use the order ticket number to let my program remember that he have done a partial close for a order already, but i see now a problem, the orderticket number does change when i make a partial close on a open order. Does somebody know what i can else use instead of the orderticket number?

qjol
3243
qjol 2014.04.24 07:44  
whroeder1
13653
whroeder1 2014.04.24 13:03  
PlanandTrade: instead of the orderticket number?
If the power fails, OS crashes, terminal or chart is accidentally closed, the next tick, the ticket variable will be lost. You will have an open order but don't know it, so the EA will never try to close it, trail SL, etc. How are you going to recover? Use a orderSelect loop no recovery, or persistent storage (GV/file) of ticket numbers required.
Ian Venner
2583
Ian Venner 2014.04.24 13:38  
i did that by adding 1 point to the stoploss each time it was partially closed
GreenMoney
379
GreenMoney 2014.04.24 20:15  
PlanandTrade:

Hello,

i wanted to code a partial close and i wanted to use the order ticket number to let my program remember that he have done a partial close for a order already, but i see now a problem, the orderticket number does change when i make a partial close on a open order. Does somebody know what i can else use instead of the orderticket number?


You might review and tweak some code (build 509) that I posted about a year ago. The PartialOrderClose() builds a list of all open orders, performs the partial OrderClose(), and then determines which order is new by comparing all open trades to the list it previously built. Upon finding the new order, PartialOrderClose() returns the ticket number for the new order. As the code suggests, it would probably be helpful to use a magic number to a particular EA (or to a set of trades).
/
To add comments, please log in or register