fxsaber: Then it's very bad for anyone trading in MT5. How to reproduce?
open positions without and with an EA on a chart, add to a position, cut a position, flip a position. the bug is not always and not immediately apparent. i experimented on a fibo demo account, build 1490
Here. Doing this. Started the Expert Advisor on a chart. I opened a position manually. I have added a position twice and cut it once. It shows 4 trades correctly in lags. After that I reversed the position and got a problem: I have a position but no deals.
Here is the log after the last two operations.
2016.12.05 14:25:44.157 Get current commission of pos (GBPUSD,M5) 1
2016.12.05 14:25:44.157 Get current commission of pos (GBPUSD,M5) GBPUSD
2016.12.05 14:25:44.157 Get current commission of pos (GBPUSD,M5) Position found
2016.12.05 14:25:44.157 Get current commission of pos (GBPUSD,M5) Total trades in position: 4
2016.12.05 14:25:44.670 Get current commission of pos (GBPUSD,M5) 1
2016.12.05 14:25:44.670 Get current commission of pos (GBPUSD,M5) GBPUSD
2016.12.05 14:25:44.670 Get current commission of pos (GBPUSD,M5) Position found
2016.12.05 14:25:44.670 Get current commission of pos (GBPUSD,M5) Total trades in position: 0
It can be seen that no trades are seen in the position. EA is still hanging on the chart and there is 0 in the comment.
I removed the EA and reset it to the chart, it does not see trades of a position, the comment is 0.
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.
No, it's not normal.
There is a position. We will throw the Expert Advisor to the chart. There is no deal history for the selected position. What is normal here?))
A position has been open for a few seconds and the number of trades is still zero?
Exactly.
Then it's very bad for anyone trading in MT5. How to reproduce?
The bug is not always and not immediately apparent. I tried it on a fibo demo account, build 1490
{
const int Total = PositionsTotal();
for (int i = 0; i < Total; i++)
{
const ulong Ticket = PositionGetTicket(i);
if (PositionSelectByTicket(Ticket) && HistorySelectByPosition(PositionGetInteger(POSITION_IDENTIFIER)) && (HistoryDealsTotal() == 0))
Alert(Ticket);
}
}
Can't reproduce.
{
const int Total = PositionsTotal();
for (int i = 0; i < Total; i++)
{
const ulong Ticket = PositionGetTicket(i);
if (PositionSelectByTicket(Ticket) && HistorySelectByPosition(PositionGetInteger(POSITION_IDENTIFIER)) && (HistoryDealsTotal() == 0))
Alert(Ticket);
}
}
Your position is selected differently. Try my code.
{
EventSetMillisecondTimer(1);
}
void OnTimer()
{
const int Total = PositionsTotal();
for (int i = 0; i < Total; i++)
if ((PositionGetSymbol(i) == _Symbol) && HistorySelectByPosition(PositionGetInteger(POSITION_IDENTIFIER)) && (HistoryDealsTotal() == 0))
Alert(PositionGetInteger(POSITION_TICKET));
}
And it's not playing.
{
EventSetMillisecondTimer(1);
}
void OnTimer()
{
const int Total = PositionsTotal();
for (int i = 0; i < Total; i++)
if ((PositionGetSymbol(i) == _Symbol) && HistorySelectByPosition(PositionGetInteger(POSITION_IDENTIFIER)) && (HistoryDealsTotal() == 0))
Alert(PositionGetInteger(POSITION_TICKET));
}
Have you tried my code?
To reproduce it in the same way and get the same logs.
Have you tried my code?
To reproduce it in the same way and get the same logs.
I tried - the problem is not reproduced.
Strange.... What could be the problem then?
Here. Doing this. Started the Expert Advisor on a chart. I opened a position manually. I have added a position twice and cut it once. It shows 4 trades correctly in lags. After that I reversed the position and got a problem: I have a position but no deals.
Here is the log after the last two operations.
2016.12.05 14:25:44.157 Get current commission of pos (GBPUSD,M5) 1
2016.12.05 14:25:44.157 Get current commission of pos (GBPUSD,M5) GBPUSD
2016.12.05 14:25:44.157 Get current commission of pos (GBPUSD,M5) Position found
2016.12.05 14:25:44.157 Get current commission of pos (GBPUSD,M5) Total trades in position: 4
2016.12.05 14:25:44.670 Get current commission of pos (GBPUSD,M5) 1
2016.12.05 14:25:44.670 Get current commission of pos (GBPUSD,M5) GBPUSD
2016.12.05 14:25:44.670 Get current commission of pos (GBPUSD,M5) Position found
2016.12.05 14:25:44.670 Get current commission of pos (GBPUSD,M5) Total trades in position: 0
It can be seen that no trades are seen in the position. EA is still hanging on the chart and there is 0 in the comment.
I removed the EA and reset it to the chart, it does not see trades of a position, the comment is 0.