Download MetaTrader 5

Timing of OrderSend function

To add comments, please log in or register
Volcanbleu
99
Volcanbleu  

Hi guys,

On regular OnTick event, I would like to know exactly WHEN the OrderSent function is done(sent) when there are other commands after it, like print or calculations. Is the Order sent right at the line processed in the code, or does MT4 ait until the Ontick code is finished?


Thanks for your help..

whroeder1
16764
whroeder1  
It's a synchronous function; send to the server, wait for the answer, return the ticket number.
Volcanbleu
99
Volcanbleu  
whroeder1:
It's a synchronous function; send to the server, wait for the answer, return the ticket number.
Can you be more precise? Do you mean that MT4 wait for the answer before continuing to interpret the code?
whroeder1
16764
whroeder1  
whroeder1: It's a synchronous function; send to the server, wait for the answer, return the ticket number.
Volcanbleu: Can you be more precise? Do you mean that MT4 wait for the answer before continuing to interpret the code?
What part of "wait for the answer" was unclear?
Volcanbleu
99
Volcanbleu  
whroeder1:
What part of "wait for the answer" was unclear?
What I would like to know, is WHEN EXACTLY the order is sent to the server when there are other calculations or orders after the order in the code within the start/ontick function.
Mohammad Hossein Sadeghi
2060
Mohammad Hossein Sadeghi  
Volcanbleu:
What I would like to know, is WHEN EXACTLY the order is sent to the server when there are other calculations or orders after the order in the code within the start/ontick function.
As whroeder1 said, once the logic in code is at the line of OrdetSend, the order is sent, the script waits for the response from the server, then it receives the ticket number in case of success or a negative number in case of error, from here the code will continue to next line(s). It doesn't take care of OnTick, it only depends on where OrderSend is, whether in OnTimer, OnTick.
Nguyen Nga
12130
Nguyen Nga  

use GetTickCount()

Volcanbleu
99
Volcanbleu  

Thanks very much Mohammad. This is the answer I wanted to have..
Mohammad Hossein Sadeghi
2060
Mohammad Hossein Sadeghi  
Volcanbleu:
Thanks very much Mohammad. This is the answer I wanted to have..
You're welcome.
To add comments, please log in or register