OrderTicket() - Question

 

When closing orders, do I have to reset or clear the value for " OrderTicket() "? I've noticed that when closing one order and opening another, the ticket number for the order being closed is the same number as the order being opened. And often the order to be opened doesn't.

 
Yellowbeard:

When closing orders, do I have to reset or clear the value for " OrderTicket() "? I've noticed that when closing one order and opening another, the ticket number for the order being closed is the same number as the order being opened. And often the order to be opened doesn't.

No.


CB

 

Use OrderSelect() to prepare the contents of OrderTicket() (and similar "order info" functions) before use.

 

From a previous post I noticed that your OrderSend(...) closely followed the OrderClose(...) Please keep in mind that whenever you interact with the trade server it takes 2 to 5 seconds to complete that operation, but MT4 tries to act on these statements in less than a millisecond unless you have properly coded for these desired results. I suspect you have other errors occuring that you may not be aware of.


Take a look at the OrderSend() code here. https://book.mql4.com/trading/ordersend Checkout the code block 2/3's the way down the page. Your OrderSend() code block should look something like this.


FWIW


raft

Reason: