So, with an OrderSend call, we could NOT get "deal" or "order" value in the result data? ... If yes, which difference there would be on the two function?
See how to get the return value in the documentation.
Not to be smug, but a link to it auto-populated in your OP above.
- www.mql5.com
See how to get the return value in the documentation.
Not to be smug, but a link to it auto-populated in your OP above.
Hi Ryan, I suspect you use a translator to translate my posts, because it's not the first time you don't understand my question.
In the reference's book, the autor let assume that we could not always get "order" value in response data. So my question is, it it true? could a broker not send "order" ticket back as respose if the return code is positive (10009-10010)?
More, i have an other question. Is the trade execution done on server side even if no response coulbe be send to us/terminal for e.g. a client network failure?
I don't understand the trading API very well and could be wrong, but I suspect that an asynchronous function doesn't wait for a response from the server at all. This means you can send multiple orders almost simultaneously. Meanwhile, each call to a regular function results in a wait for a response from the trading server.
Compare the description of these functions in the documentation (if you haven't done so yet):
I just recently mentioned in another topic that asynchronous trading is of interest to me and I'm going to try playing with it, but later, I don't have enough time for that yet.
Try writing two scripts. Both send several (say, five) orders in a row, but one uses a regular function and the other an asynchronous one. Run the scripts and compare their execution times (on a demo account, of course).
This is one of the experiments that I was going to do as part of my study of the trading API, but later - when I have time😁
[edit] But I think the asynchronous option requires more complex algorithms. At first glance, it seems as if the advisor should store the orders it has sent somewhere until it knows their results.So, with an OrderSend call, we could NOT get "deal" or "order" value in the result data? ... If yes, which difference there would be on the two function?
OrderSend waits for an answer from MT5 server (can block MQL5 program for a while), OrderSendAsync does not (it returns control to MQL5 program right away).
The book provides an example of sending a bunch of orders by OrderSend and OrderSendAsync to compare the speed of sending requests and getting results.
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
i readed this book's reference page, and now i'm really confused.
It's clear that OrderSendAsync doesn't get any in the result but "request id", but it seems that with OrderSend we cannot have guarantee on what we can get on result data.
"It's important to note that despite the "Async" suffix in the second function's name, the first function without this suffix is also not fully synchronous. The fact is that the result of order processing by the server, in particular, the execution of a deal (or, probably, several deals based on one order) and the opening of a position, generally occurs asynchronously in an external trading system. So the OrderSend function also requires delayed collection and analysis of the consequences of request execution, which MQL programs must, if necessary, implement themselves"Reading these two statements:
About OrderSend: "The trade server can fill the field deal or order values in the returned result structure if this data is known at the time the server formats an answer to the OrderSend call. However, in the general case, the events of deal execution or placing limit orders corresponding to an order can occur after the response is sent to the MQL program in the terminal. Therefore, for any type of trade request, when receiving the execution OrderSend result, it is necessary to check the trade server return code retcode and external trading system response code retcode_external (if necessary) which are available in the returned result structure. Based on them, you should decide whether to wait for pending actions on the server or take your own actions."
So, with an OrderSend call, we could NOT get "deal" or "order" value in the result data? ... If yes, which difference there would be on the two function?