POSITION_COMMISSION-property removed!?

 

I just noticed that MetaQuotes' own Commission()-function no longer works, because its code is...

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

  }

...and POSITION_COMMISSION seems to no longer be a member of ENUM_POSITION_PROPERTY_DOUBLE, which would be available to PositionGetDouble().

Since MetaQuotes did not update their own Commission()-function accordingly and since POSITION_COMMISSION still is an important piece of information I assume the loss of POSITION_COMMISSION is a mistake.

@MetaQuotes: Can you please add POSITION_COMMISSION to ENUM_POSITION_PROPERTY_DOUBLE again or how else should we get the commission of the current position??

Many thanks in advance!
Documentation on MQL5: Standard Library / Trade Classes / CDealInfo / Commision
Documentation on MQL5: Standard Library / Trade Classes / CDealInfo / Commision
  • www.mql5.com
Standard Library / Trade Classes / CDealInfo / Commision - Reference on algorithmic/automated trading language for MetaTrader 5
 

What makes you think anything has changed ? I didn't notice it.

POSITION_COMMISSION is still compiling and undocumented. I didn't investigate to check if it works correctly or not.

You need to use DEAL_COMMISSION.

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Position Properties
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Position Properties
  • www.mql5.com
Position ticket. Unique number assigned to each newly opened position. It usually matches the ticket of an order used to open the position except when the ticket is changed as a result of service operations on the server, for example, when charging swaps with position re-opening. To find an order used to open a position, apply the...
 
Alain Verleyen:

What makes you think anything has changed ? I didn't notice it.

POSITION_COMMISSION is still compiling and undocumented. I didn't investigate to check if it works correctly or not.

PositionGetDouble(POSITION_COMMISSION) doesn't work (any longer). The first sign is that POSITION_COMMISSION is not offered by AutoComplete or highlighted in MetaEditor when typed manually and — most importantly — ...

   PositionSelect(_Symbol);

   Alert(PositionGetDouble(POSITION_COMMISSION));

...always returns 0, even if commission is charged according to MetaTrader 5 → Toolbox → History → "Commission" column.

 
QuickPip:

PositionGetDouble(POSITION_COMMISSION) doesn't work (any longer). The first sign is that POSITION_COMMISSION is not offered by AutoComplete or highlighted in MetaEditor when typed manually and — most importantly — ...

   PositionSelect(_Symbol);

   Alert(PositionGetDouble(POSITION_COMMISSION));

...always returns 0, even if commission is charged according to MetaTrader 5 → Toolbox → History → "Commission" column.

I know. I just said you nothing has changed recently to my knowledge, it's like that for at least 3 years.
 
Alain Verleyen:
I know. I just said you nothing has changed recently to my knowledge, it's like that for at least 3 years.
Ok, so PositionGetDouble(POSITION_COMMISSION) hasn't worked for 3 years. But shouldn't it finally be fixed? We need this function to accurately calculate the current profit. Could you ask MetaQuotes to fix it, please?
 
QuickPip:
Ok, so PositionGetDouble(POSITION_COMMISSION) hasn't worked for 3 years. But shouldn't it finally be fixed? We need this function to accurately calculate the current profit. Could you ask MetaQuotes to fix it, please?

Are you reading what I write ?

Forum on trading, automated trading systems and testing trading strategies

POSITION_COMMISSION-property removed!?

Alain Verleyen, 2020.06.29 20:25

What makes you think anything has changed ? I didn't notice it.

POSITION_COMMISSION is still compiling and undocumented. I didn't investigate to check if it works correctly or not.

You need to use DEAL_COMMISSION.

POSITION_COMMISSION is obsolete, there is nothing to fix.
 
Alain Verleyen:

Are you reading what I write ?


I know DEAL_COMMISSION, but it's a somewhat different approach and who knows whether it delivers exactly the same commission-value as POSITION_COMMISSION. DEAL_COMMISSION delivers only the half-turn commission and only for the past — and you have to explicitly define the past, too, and query all that past just to get that one, current value. Anyway, if MetaQuotes still use PositionGetDouble(POSITION_COMMISSION) themselves in their own Standard Library, then it follows that PositionGetDouble(POSITION_COMMISSION) should still work, too, or else it's a bug in their Standard Library and the Library needed to be fixed. I'd prefer PositionGetDouble(POSITION_COMMISSION) to work again because the more options they give to their clients the better, and PositionGetDouble(POSITION_COMMISSION) would be more straightforward than the other option. Don't you agree? ;-)

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Position Properties
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Position Properties
  • www.mql5.com
Position ticket. Unique number assigned to each newly opened position. It usually matches the ticket of an order used to open the position except when the ticket is changed as a result of service operations on the server, for example, when charging swaps with position re-opening. To find an order used to open a position, apply the...
 

Commission on forex is single trip, so exit commission is only known AFTER closing position.This means there can not exist a POSITION_COMISSION before the event. For exchange it may be number of ways commission is handled. 

Like always there is no single "fix all" cheap way out. Deal with it.

 
QuickPip:

I know DEAL_COMMISSION, but it's a somewhat different approach and who knows whether it delivers exactly the same commission-value as POSITION_COMMISSION. DEAL_COMMISSION delivers only the half-turn commission and only for the past — and you have to explicitly define the past, too, and query all that past just to get that one, current value. Anyway, if MetaQuotes still use PositionGetDouble(POSITION_COMMISSION) themselves in their own Standard Library, then it follows that PositionGetDouble(POSITION_COMMISSION) should still work, too, or else it's a bug in their Standard Library and the Library needed to be fixed. I'd prefer PositionGetDouble(POSITION_COMMISSION) to work again because the more options they give to their clients the better, and PositionGetDouble(POSITION_COMMISSION) would be more straightforward than the other option. Don't you agree? ;-)

No I don't agree, see Enrique answer. POSITION_COMMISSION is obsolete because it's not a workable solution to deal with commission on all markets managed by MT5, it's not universal.

There exist several cases where effectively the commission is not known before the position close.

 
Enrique Dangeroux:

Commission on forex is single trip, so exit commission is only known AFTER closing position.This means there can not exist a POSITION_COMISSION before the event. For exchange it may be number of ways commission is handled. 

Like always there is no single "fix all" cheap way out. Deal with it.

You don't get the point. The point is that MetaQuotes' Standard Library still includes Commission(), which is based on PositionGetDouble(POSITION_COMMISSION),which doesn't work any longer (always returns 0). So if PositionGetDouble(POSITION_COMMISSION) is deprecated, the Standard Library needs to be updated accordingly or vice versa. Or do you want to sell me a bug as a feature!? :-P
 

Personally i do not use any of the standard libs so my answer was not with that in mind. 

If it is used in the standard lib, then it needs to be fixed.

Reason: