There is a block named "Check profit (unrealized)"
inside this block there is a function call named "OrderCommission()"
this function returns 0. so the commission is not read correctly.
instead of this function it's better to use following code which check commissions of all deals of current open position:
double total_commission = 0.0;
ulong ticket = PositionGetTicket(index);
if(PositionSelectByTicket(ticket))
{
// Select deals for this position
HistorySelect(0, TimeCurrent()); // select all history deals up to now
int deals_total = HistoryDealsTotal();
for(int i = 0; i < deals_total; i++)
{
ulong deal_ticket = HistoryDealGetTicket(i);
ulong deal_position_id = HistoryDealGetInteger(deal_ticket, DEAL_POSITION_ID);
if(deal_position_id == ticket)
{
double commission = HistoryDealGetDouble(deal_ticket, DEAL_COMMISSION);
total_commission += commission;
}
}
}