Features of the mql5 language, subtleties and tricks - page 172

 
Alexey Viktorov:

It would be much clearer if you took a picture.

Updated above.

 
fxsaber:

Live BuyLimit.

Well, it shows the volumes - filled and remaining volumes. It shows the partial execution. Or I do not understand the problem?
 
Artyom Trishkin:
Well, it shows the volumes - the filled and the remaining volume. You can see that it is a partial execution. Or maybe I do not understand the problem?

The time of the order has changed to the time of partial execution.

Perhaps, we have to pay attention of the developers. Maybe we should introduce one more property of the order.

 
Alexey Viktorov:

The time of the order has changed to the time of partial execution.

It is clearly visible here.



I do not know what will happen when the order is partially executed again.

Forum on trading, automated trading systems and strategy testing

Libraries: MT4Orders

fxsaber, 2020.04.07 18:47

Partial execution is very easy to find in MT5.
// true - сделка в результате частичного исполнения.
bool IsPartial( const ulong TicketDeal )
{
  const ulong TicketOrder = HistoryDealGetInteger(TicketDeal, DEAL_ORDER);
  
  return((HistoryDealGetInteger(TicketDeal, DEAL_TYPE) <= DEAL_TYPE_SELL) &&
         (!TicketOrder ||
          (HistoryDealGetDouble(TicketDeal, DEAL_VOLUME) != HistoryOrderGetDouble(TicketOrder, ORDER_VOLUME_INITIAL))));
}


// Вывод всех частично-исполненных сделок.

input datetime inFrom = D'2020.01.01';

void OnStart()
{
  if (HistorySelect(inFrom, INT_MAX))
  {
    for (int i = HistoryDealsTotal() - 1; i >= 0; i--)
    {
      const ulong TicketDeal = HistoryDealGetTicket(i);
      
      if (IsPartial(TicketDeal))
        Print(TicketDeal);
    }
  }
}
 
fxsaber:

You can see well here.


This can be bad at all in some cases. This should definitely be reported to the developers.

 
fxsaber:

You can see well here.



What will happen with a second partial performance - I don't know.

And you have the history set to show orders and trades. If you change it to only orders?

 
Alexey Viktorov:

This can be bad in some cases at all. This should definitely be reported to the developers.

It's hard to say whether this is a bad thing or not. Also, the CloseBy collapse seems to lose the majicas. You need to check it out.

 
Alexey Viktorov:

And your history is set to show orders and deals. If you change it to only orders?

This is the Deal mode. In other modes it will not be visible, because the order is still alive.

 
fxsaber:

This is the Deal mode. It will not be visible in the other modes as the order is still alive.

I have poked around and realised that these are trades. But in this case the time of the trade is shown, not the order. That's why it's interesting to see in order mode.

 
Alexey Viktorov:

I have poked around and realised that these are trades. But in this case it shows the time of the trade, not the order. That's why it's interesting to see in order mode.

There can be no order in order mode when it is alive. When dead - there will be a time of first execution, as originally said.