Commissions are important to know for backtesting but not accessible

chinaski
1157
chinaski  

This code always returns zero for commissions


void OnTradeTransaction(const MqlTradeTransaction& trans,
                        const MqlTradeRequest& request,
                        const MqlTradeResult& result)
  {
        if(trans.symbol == Symbol())
        {
                if((int) trans.deal_type == (int) __order_type
                        && trans.type == TRADE_TRANSACTION_DEAL_ADD
                        )
                {
                        ++__trans_count;
                        __last_entry=trans.price;
                        double volume=trans.volume;

                        double commissions=HistoryDealGetDouble(trans.deal,DEAL_COMMISSION);

                        PrintFormat("entry-price=%.8f commissions=%.2f transcount=%d",__last_entry,commissions,__trans_count);
                }
                
        }      
  }
William Roeder
25037
William Roeder  

Don't double post! You already had another thread open.

          General rules and best pratices of the Forum. - General - MQL5 programming forum 2017.07.19