Download MetaTrader 5
To add comments, please log in or register
Added support for the Spanish language. Come and check it out!
Peperlizio
27
Peperlizio 2014.03.03 16:26 

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?

Ubzen
Moderator
5394
Ubzen 2014.03.03 16:35  
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.

Peperlizio
27
Peperlizio 2014.03.03 16:42  
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.
whroeder1
13610
whroeder1 2014.03.03 17:39  
Peperlizio: but i need to know commission that broker charge
Why do you think us USERs would know what commission YOUR broker charges?
Peperlizio
27
Peperlizio 2014.03.03 18:04  
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?

Alain Verleyen
Moderator
28556
Alain Verleyen 2014.03.03 18:32  
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.

Peperlizio
27
Peperlizio 2014.03.03 22:02  
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.
jackprobe
24
jackprobe 2014.06.13 12:59  

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
24
jackprobe 2014.06.13 13:16  
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

/
To add comments, please log in or register