Scripts: Get Position commission OrderCommission (mt4 term) of an active position in MT5

 

Get Position commission OrderCommission (mt4 term) of an active position in MT5:

Get commission of an active position in mt5 , its easy to use function.

Author: Farrukh Aleem

 
ed
 
I'm so thankful for this. It's taken me days of reading MT5 docs, functions, articles and writing test scripts in order to accumulate the commission charged for each open position. NOTE that the commission is not available from the PositionGetDouble() function. Commission is stored as part of the deal with no obvious connection to that deal when you have the position ticket. Farrukh you saved me from insanity with less than 20 lines of code. Thank you!
 
It always shows: Commission = 0.0.
 

In SymbolInfo.mqh:

double CPositionInfo::Commission(void) const
  {
   return(PositionGetDouble(POSITION_COMMISSION));
  }

this function is symple.