Need know when a deal is done, if: (1) it created/scaled in, or (2) closed/scaled out, or (3) reversed position.
As I understand it DEAL_ENTRY_IN would indicate if (1); DEAL_ENTRY_OUT would indicate if (2); and DEAL_ENTRY_INOUT if (3).
However, no matter if I open a position, close, scale, or reverse - always only DEAL_ENTRY_IN is indicated (terminal build 756, @Alpari):
Is your ticket number correct ?
Is your ticket number correct ?
Well, when a deal happens OnTradeTransaction is invoked, with the corresponding MqlTradeTransaction structure holding the deal ticket (see code above).
Querying HistoryDealGetInteger with DEAL_ENTRY and that deal's ticket should in theory yield the deal's effect on the position..

- www.mql5.com
Well, when a deal happens OnTradeTransaction is invoked, with the corresponding MqlTradeTransaction structure holding the deal ticket (see code above).
Querying HistoryDealGetInteger with DEAL_ENTRY and that deal's ticket should in theory yield the deal's effect on the position..
Yes, I read the documentation, but is your ticket number correct ? if you . . .
Print("Ticket number: ", trans.deal);
. . what do you get ? do you get the correct ticket number ?
. . what do you get ? do you get the correct ticket number ?
I open a position manually (from terminal->new order, mkt), get one ticket; then I close this position by opposit trade in the same way, and get another (different) ticket. So all correct. But both times I get DEAL_ENTRY_IN.
All I want to know is how a deal (that triggered OnTradeTransaction) changed related position.
According to docs DEAL_ENTRY_IN be indicative of opening or increasing a position; while DEAL_ENTRY_OUT be indicative of closing/decreasing a position etc., but so far no luck.
I open a position manually (from terminal->new order, mkt), get one ticket; then I close this position by opposit trade in the same way, and get another (different) ticket. So all correct. But both times I get DEAL_ENTRY_IN.
All I want to know is how a deal (that triggered OnTradeTransaction) changed related position.
According to docs DEAL_ENTRY_IN be indicative of opening or increasing a position; while DEAL_ENTRY_OUT be indicative of closing/decreasing a position etc., but so far no luck.
OK, I'll try one last time . . . .
What do yo get printed when you Print the ticket number you are using ? is it the correct ticket number ?
OK, I'll try one last time . . . .
What do yo get printed when you Print the ticket number you are using ? is it the correct ticket number ?
I have tested it. This is a bug. Effectively HistoryDealGetInteger(trans.deal, DEAL_ENTRY) always return DEAL_ENTRY_IN when you open AND when you close a trade.
You have to fill a request to Service Desk.

- www.mql5.com
I have tested it. This is a bug. Effectively HistoryDealGetInteger(trans.deal, DEAL_ENTRY) always return DEAL_ENTRY_IN when you open AND when you close a trade.
You have to fill a request to Service Desk.
Seems so.
Also my particular treminal build (756) seems old, but did/does not offer to update..
Anyway, how do I file a request?
I use build 773.
For a request, goto to your profile, then Service Desk.
Thanks. Have done so.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Need know when a deal is done, if: (1) it created/scaled in, or (2) closed/scaled out, or (3) reversed position.
As I understand it DEAL_ENTRY_IN would indicate if (1); DEAL_ENTRY_OUT would indicate if (2); and DEAL_ENTRY_INOUT if (3).
However, no matter if I open a position, close, scale, or reverse - always only DEAL_ENTRY_IN is indicated (terminal build 756, @Alpari):