What's up with DEAL_ENTRY_* ? - page 2

 

This article

https://www.mql5.com/en/articles/40

seems to indicate that DEAL_ENTRY isn't sufficient for determining what happened, you subsequently have to check DEAL_TYPE.

The article is a few years old but I hope it is still valid since I have been studying it in detail the last few days.

Rik
Processing of trade events in Expert Advisor using the OnTrade() function
Processing of trade events in Expert Advisor using the OnTrade() function
  • 2010.07.22
  • KlimMalgin
  • www.mql5.com
MQL5 gave a mass of innovations, including work with events of various types (timer events, trade events, custom events, etc.). Ability to handle events allows you to create completely new type of programs for automatic and semi-automatic trading. In this article we will consider trade events and write some code for the OnTrade() function, that will process the Trade event.
 
rik:

This article

https://www.mql5.com/en/articles/40

seems to indicate that DEAL_ENTRY isn't sufficient for determining what happened, you subsequently have to check DEAL_TYPE.

The article is a few years old but I hope it is still valid since I have been studying it in detail the last few days.

Rik

No, I don't think so.

This code does the same as mine (checks for DEAL_ENTRY), implying that all cases can occur. However, my problem is that only ever DEAL_ENTRY_IN is occurring, while all cases should occur according to buy/sell/reverse operations.

Subsequent checking for DEAL_TYPE will give additional information, however not relevant in my case (for it is only a simple test).

 
S.L:

No, I don't think so.

This code does the same as mine (checks for DEAL_ENTRY), implying that all cases can occur. However, my problem is that only ever DEAL_ENTRY_IN is occurring, while all cases should occur according to buy/sell/reverse operations.

Subsequent checking for DEAL_TYPE will give additional information, however not relevant in my case (for it is only a simple test).

how bout this then... since you aren't calling HistorySelect(...), you aren't selecting from the latest history?

Documentation on MQL5: Trade Functions / HistorySelect
Documentation on MQL5: Trade Functions / HistorySelect
  • www.mql5.com
Trade Functions / HistorySelect - Documentation on MQL5
 

Yeah, problem solved:

One has to first copy [the deal] into [the deals] cache via i.e. HistoryDealSelect(deal_ticket) !?

Then one can query for i.e. HistoryDealGetInteger(...) ...

Not very intuitive though..

 

Reason: