How to get commission per lot in MQL5 - page 2

 
@Alain Verleyen #: What do you mean ? I have never seen that in the GUI, what I missed ?

I have never seen myself, but I have seen posts where users have included screenshots of Contract Specifications where there is a section with Commissions. Here are two screenshots I found via Google Image search ...


 
@Alain Verleyen #: What do you mean ? I have never seen that in the GUI, what I missed ?

It is also mentioned in the following thread, in the section "3. Terminal: New fields in the trading symbol specification:"

 
fxsaber #:

MarketWatch -> Specification.

Ah ok, that is not in the Market Watch window itself.

Thank you.

 
Fernando Carreiro #:

It is also mentioned in the following thread, in the section "3. Terminal: New fields in the trading symbol specification:"

Yes I am was aware about it, just confused as Amrali mentioned the Market Watch.

Thank you.

 
Dear Alain,
I might have not explained it well. Execuse me, as English is not my first language. 
I hope MetaQuotes add this feature to mql, as long as the gui component has the info readily available,  it is trivial to add it to mql SymbolInfo() function.
 
amrali:
Is there a programagic way (like SymbolInfoDouble, or AccountInfoDouble) to get the broker's commission per lot. 

From the market watch window, I can get it by right click on a symbol -> symbol specs. 

Anybody has an idea how the market watch window implemented it? 

I suggest this feature should be added to mql. 

Yes, We can calculate the commission for operation. I use in my EAs:


//+------------------------------------------------------------------+

//|Profit  Buy                                                       |

//+------------------------------------------------------------------+

double Profit_Buy(int magic_number)

  {

   double profit = 0;



   for(int i = PositionsTotal() - 1; i >= 0; i--)

      if(PositionSelectByTicket(PositionGetTicket(i)) && PositionGetInteger(POSITION_MAGIC) == magic_number && (ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY && PositionGetString(POSITION_SYMBOL) == Symbol())

         profit = profit + PositionGetDouble(POSITION_PROFIT) - MathAbs(PositionGetDouble(POSITION_SWAP)) + MathAbs(PositionGetDouble(POSITION_COMMISSION));



   return profit;

  }

//+------------------------------------------------------------------+





//+------------------------------------------------------------------+

//|Profit  Sell                                                      |

//+------------------------------------------------------------------+

double Profit_Sell(int magic_number)

  {

   double profit = 0;



   for(int i = PositionsTotal() - 1; i >= 0; i--)

      if(PositionSelectByTicket(PositionGetTicket(i)) && PositionGetInteger(POSITION_MAGIC) == magic_number && (ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_SELL && PositionGetString(POSITION_SYMBOL) == Symbol())

         profit = profit + PositionGetDouble(POSITION_PROFIT) + PositionGetDouble(POSITION_SWAP) + MathAbs(PositionGetDouble(POSITION_COMMISSION));



   return profit;

  }

//+------------------------------------------------------------------+
 
Jhon Michael Antony Florez Roa #:

Yes, We can calculate the commission for operation. I use in my EAs:


Please read the post from the beginning. Your answer is irrelevant here.