Order Commission

 

How can i get Symbol Commission?

I need to calc Commission for order, no issues with OP_BUY and OP_SELL, but with pending orders (OP_BUYSTOP, OP_BUYLIMIT, OP_SELLSTOP, OP_SELLLIMIT) OrderCommission() return always 0.

Any solutions?

 
Peperlizio:

How can i get Symbol Commission?

I need to calc Commission for order, no issues with OP_BUY and OP_SELL, but with pending orders (OP_BUYSTOP, OP_BUYLIMIT, OP_SELLSTOP, OP_SELLLIMIT) OrderCommission() return always 0.

Any solutions?

I don't think the broker would charge commission for orders which haven't gone through yet.

I mean what if you cancel the pending order, that would be sad if they already charged you commission.

 
ubzen:

I don't think the broker would charge commission for orders which haven't gone through yet.

I mean what if you cancel the pending order, that would be sad if they already charged you commission.


That's Ok, but i need to know commission that broker charge before order will be filled or i can't calculate right gain or loss for that order.
 
Peperlizio: but i need to know commission that broker charge
Why do you think us USERs would know what commission YOUR broker charges?
 
WHRoeder:
Why do you think us USERs would know what commission YOUR broker charges?

It's not MY broker charge, it'a a GENERAL issue.

if Broker commission is for example 5$ per Lots in Forex instruments when i open a market order i can see commission and i can return that value with OrderCommission()

Profit = OrderProfit()+OrderCommission();

Profit is correctly 5$ decreased, but if i wanna know a potential gain or a potential loss from a pending order?

Example with a BuyStop order, OrderCommission return 0, so:

Profit = (OrderTakeProfit()-OrderOpenPrice) * GainPerPoint - Commission;
Loss   = (OrderOpenPrice()-OrderStopLoss()) * GainPerPoint + Commission;

where GainPerPoint depend from Order Lots, Instrument traded and Account currency.

But how can i get Commission variable? Why i can get parameters like SYMBOL_SWAP_LONG and SHORT from MarketInfo() and there's not a simple SYMBOL_COMMISSION? Where's stored that info?

 
Peperlizio:

It's not MY broker charge, it'a a GENERAL issue.

if Broker commission is for example 5$ per Lots in Forex instruments when i open a market order i can see commission and i can return that value with OrderCommission()

Profit is correctly 5$ decreased, but if i wanna know a potential gain or a potential loss from a pending order?

Example with a BuyStop order, OrderCommission return 0, so:

where GainPerPoint depend from Order Lots, Instrument traded and Account currency.

But how can i get Commission variable? Why i can get parameters like SYMBOL_SWAP_LONG and SHORT from MarketInfo() and there's not a simple SYMBOL_COMMISSION? Where's stored that info?

It's a good question. As far as I know it's not possible, you can only calculate this commission if you know it's for example $5 per lot. But it's not possible to find this value ($5) with MT4 directly.

I can see an indirect way, if you already have a closed traded, you can calculate the commission per lot value in your EA, and then use it for your pending orders.

 
angevoyageur:

It's a good question. As far as I know it's not possible, you can only calculate this commission if you know it's for example $5 per lot. But it's not possible to find this value ($5) with MT4 directly.

I can see an indirect way, if you already have a closed traded, you can calculate the commission per lot value in your EA, and then use it for your pending orders.


Well, i'm trying to follow this way if there's no other solutions, thanks for your reply.
 

Hi,

I can see there is "commission" at my MT4 build 646 platform. How can i get that value ? Is it impossible to get the commission of an open order (not yet closed) ??

I try to create a function and call that function, print the result. But i always can not get the commission value ... :(

Please help,

Thanks

===================================================

commission


I try to call a function like this:

double getCommission = calcCommission();


The calcCommission() function is :

//+------------------------------------------------------------------+
double calcCommission() {   
   double retTotCom = 0;
   for (int cnt = OrdersTotal(); cnt > 0; cnt--) {
      if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() != Symbol()) continue;
         if ((OrderSymbol() == Symbol())&&(OrderCloseTime() == 0)) {
            retTotCom += OrderCommission();
         }
      }
   } // ende for
   return(retTotCom);
}
 
jackprobe:

Hi,

I can see there is "commission" at my MT4 build 646 platform. How can i get that value ? Is it impossible to get the commission of an open order (not yet closed) ??

I try to create a function and call that function, print the result. But i always can not get the commission value ... :(

Please help,

Thanks

===================================================



I try to call a function like this:


The calcCommission() function is :


Hi I found it,

Sorry for my carelessness ....

It must be like this :

//+------------------------------------------------------------------+
double calcCommission() {   
   double retTotCom = 0;
   for (int cnt = OrdersTotal()-1; cnt >= 0; cnt--) {
      if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() != Symbol()) continue;
         if ((OrderSymbol() == Symbol())&&(OrderCloseTime() == 0)) {
            retTotCom += OrderCommission();
         }
      }
   } // ende for
   return(retTotCom);
}


The problem is at OrderSelect, it must be begin from "0" , not "1"  :

for (int cnt = OrdersTotal()-1; cnt >= 0; cnt--) {


Thanks

Reason: