Multiple positions opened with one request

 

Hi folks,

I can't get any further with the following problem:
My EA opens positions fine (in Tester) until it suddenly opens 7 positions from one request (while it should open 1). It is always the same request when this happens and I can't figure out what I'm doing wrong. 
I'm using CTrade to open the positions but I can't see anything wrong in the sources.


These are the request and the result:

And these are the positions it opens from the request:

I'm completely stuck. Any help is greatly appreciated.
Best regards

Holger

 
mrhoga: I can't get any further with the following problem: My EA opens positions fine (in Tester) until it suddenly opens 7 positions from one request (while it should open 1). It is always the same request when this happens and I can't figure out what I'm doing wrong. I'm using CTrade to open the positions but I can't see anything wrong in the sources. These are the request and the result: And these are the positions it opens from the request: I'm completely stuck. Any help is greatly appreciated.

Without your code sample, we are unable to verify what it is you are doing wrong. We can only guess and make assumptions!

Don't make it difficult or we will just ignore your request. If you want help, then make it easier for us to be able to help.

 
Fernando Carreiro:

Without your code sample, we are unable to verify what it is you are doing wrong. We can only guess and make assumptions!

Don't make it difficult or we will just ignore your request. If you want help, then make it easier for us to be able to help.

Thanks for your reply. I thought my problem would be obvious from the screenshots. But eventually that was a misconception based on a misunderstanding on my side :)
I was thinking that for market orders the 'deal' and 'order' value of the result should be the same because order is not used at market execution and that deal eventually represents the ticket number. That's why I build my position management around the value returned in deal. That was wrong.
After digging into the OnTradeTransaction event I was finally able to figure it out and after changing my position management everything works fine now. 
It would be nice if there was some more documentation about what's going on server-side. Finally this article put me in the right direction: https://www.mql5.com/en/articles/1111 

MQL5 Cookbook: Processing of the TradeTransaction Event
MQL5 Cookbook: Processing of the TradeTransaction Event
  • www.mql5.com
This article considers capabilities of the MQL5 language from the point of view of the event-driven programming. The greatest advantage of this approach is that the program can receive information about phased implementation of a trade operation. The article also contains an example of receiving and processing information about ongoing trade operation using the TradeTransaction event handler. In my opinion, such an approach can be used for copying deals from one terminal to another.