Commissions are important to know for backtesting but not accessible


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
                        double volume=trans.volume;

                        double commissions=HistoryDealGetDouble(,DEAL_COMMISSION);

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

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