
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
1) I don't think it's related to the issue of this topic. The issue we get is in case of a request was filled successfully and a position is opened. But this position is opened on the trade server, the problem we encountered is when there is a delay more important as usual and the MT5 terminal is notified of this new position AFTER a new tick is already processed.
2) ... in my opinion it's a poor designed for a platform who allow explicitly synchronous and asynchronous trading requests ...
3) ... the ResultRetCode is synchronous, it's the updated of the MT5 database about position (deal and order) who is asynchronous ...1) Disagree, and sorry the ignorance, but how are you so sure that the position is opened after PositionOpen() in the trade server without double check the ResultRetcode()?
2) 100% agree.
3) For sure ResultRetCode() is synchronous, I mean to check the result code you (master) must query the server (slave) with several "asynchronous" messages.
1) Disagree, and sorry the ignorance, but how are you so sure that the position is opened after PositionOpen() in the trade server without double check the ResultRetcode()?
2) 100% agree.
3) For sure ResultRetCode() is synchronous, I mean to check the result code you (master) must query the server (slave) with several "asynchronous" messages.
1) This topic is about a double entry, so we are talking about a order request which was successful. I never wrote that it's not necessary to double check the ResultRetCode(), I wrote exactly the contrary. But this is NOT related to the double entry, by definition. Isn't obvious ?
3) It's probably a detail (incomprehension ?) but what you wrote doesn't make sense. In the first part of your sentence you said ResultRetCode() is synchronous, in the second you said that "result code" which is the same as ResultRetCode() is obtain asynchronously. There is no communication AT ALL between the server and the terminal to get this value (Retcode).
CTrade.PositionOpen() by default is synchronous, that means the underlying class use OrderSend(). Which send the order request and wait the reply from the server. The server return the result to the terminal, and the EA code continue (with returned value true or false). The master/slave communication is over. After that you can check the ResultRetcode, which is already available locally.
Is there a timeout for position open?
Hello doshur, what to you mean exactly with timeout?
1) This topic is about a double entry, so we are talking about a order request which was successful. I never wrote that it's not necessary to double check the ResultRetCode(), I wrote exactly the contrary. But this is NOT related to the double entry, by definition. Isn't obvious ?
3) It's probably a detail (incomprehension ?) but what you wrote doesn't make sense. In the first part of your sentence you said ResultRetCode() is synchronous, in the second you said that "result code" which is the same as ResultRetCode() is obtain asynchronously. There is no communication AT ALL between the server and the terminal to get this value (Retcode).
CTrade.PositionOpen() by default is synchronous, that means the underlying class use OrderSend(). Which send the order request and wait the reply from the server. The server return the result to the terminal, and the EA code continue (with returned value true or false). The master/slave communication is over. After that you can check the ResultRetcode, which is already available locally.
Alain,
About 1) I still disagree, since for me the original code of doshur don't check ResultRetCode() and he is looking for a solution to the "double entry", and for me we have to address this is his code (as Malacarne proposed). So for me it isn't so obvious.
About 3) You wrote "However the ResultRetCode is synchronous, it's the updated of the MT5 database about position (deal and order) who is asynchronous." so my answer was about this sentence.
Anyway, our debate looks like the story about the half-cup of water: some will see it as half full and some as half empty, but it is a question of whether one regards the glass as being half full, or as being half empty ;-)))
So, to be honest, I don't believe that this debate is produtive and/or must continue (at least here in this topic), since we can come back to workaround solutions, so please sorry for creating such controversy and please go ahead with your line of thought, that I think will be more suited to help doshur and other guys with the same problem.
@figurelli: Congrats on becoming Moderator ... .
Well, all the workaround posted are very good. I appreciate it and learn some ideas along the way.
You guys are helpful.
My EA seems to be more resilient now.
...
So, to be honest, I don't believe that this debate is produtive and/or must continue (at least here in this topic), since we can come back to workaround solutions, so please sorry for creating such controversy and please go ahead with your line of thought, that I think will be more suited to help doshur and other guys with the same problem.