int count = HistoryDealsTotal();
ulong tik = HistoryDealGetTicket(count-1);
ENUM_DEAL_REASON drrr2 = HistoryDealGetInteger(tik1+1, DEAL_REASON);
When using the debugger (tester), values of variables is as follows, while they are different from the History table of deals.
watch window:
History table in tester:
As it is known, the number of deals must be 2, which function (HistoryDealsTotal) returned 1 (count)! Also, the reason for the deal with ticket 3 is the activation of SL, which the function( HistoryDealGetInteger(tik1+1, DEAL_REASON) ) returned its value incorrectly! ( DEAL_REASON_CLIENT instead of DEAL_REASON_SL )
I tried every DEAL_PROPERTY the results were still incorrect.
I also used this code in the beginning of the expert, which is not useful .
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
My code is as follows:
When using the debugger (tester), values of variables is as follows, while they are different from the History table of deals.
watch window:
History table in tester:

As it is known, the number of deals must be 2, which function (HistoryDealsTotal) returned 1 (count)!Also, the reason for the deal with ticket 3 is the activation of SL, which the function( HistoryDealGetInteger(tik1+1, DEAL_REASON) ) returned its value incorrectly! ( DEAL_REASON_CLIENT instead of DEAL_REASON_SL )
I also used this code in the beginning of the expert, which is not useful .