'PositionTotal()' WARNING deprecated behavior, hidden method calling will be disabled in a future MQL compiler version

 

Please help to identify why this warning message is coming and solution to same.

void CStrategy::RebuildPositions(void)
  {
    ActivePositions.Clear();
    ENUM_ACCOUNT_MARGIN_MODE mode = (ENUM_ACCOUNT_MARGIN_MODE)AccountInfoInteger(ACCOUNT_MARGIN_MODE);
    if(mode != ACCOUNT_MARGIN_MODE_RETAIL_HEDGING)
      {
        for(int i = 0; i < PositionsTotal(); i++) // 'PositionTotal()' WARNING deprecated behavior, hidden method calling will be disabled in a future MQL compiler version
          {
            string symbol = PositionGetSymbol(i);
            PositionSelect(symbol);
            CPosition *pos = new CPosition();
            ActivePositions.Add(pos);
          }
      }
    else
      {
        for(int i = 0; i < PositionsTotal(); i++) // 'PositionTotal()' WARNING deprecated behavior, hidden method calling will be disabled in a future MQL compiler version
          {
            ulong ticket = PositionGetTicket(i);
            PositionSelectByTicket(ticket);
            CPosition *pos = new CPosition();
            ActivePositions.Add(pos);
          }
      }
  }
 
Because you have a custom method PositionsTotal() which is hidden by the built-in PositionsTotal().
 
Alain Verleyen:
Because you have a custom method PositionsTotal() which is hidden by the built-in PositionsTotal().

Thanks Alain :)

yes I found the method defined as PositionTotal and renamed it to Get_PositionTotal. It seems to be working without error now.

However, I noticed another method defined as OrdersTotal, but do not get any error for it !

I am trying to use concepts from "Universal Expert Advisor" by Vasiliy Sokalov ... :) and good learning exposure for a newbie like me.

Thanks for pointing out the error area.

 
Anil Varma - #:

Thanks Alain :)

yes I found the method defined as PositionTotal and renamed it to Get_PositionTotal. It seems to be working without error now.

However, I noticed another method defined as OrdersTotal, but do not get any error for it !

I am trying to use concepts from "Universal Expert Advisor" by Vasiliy Sokalov ... :) and good learning exposure for a newbie like me.

Thanks for pointing out the error area.

You can also use the built-in Scope Resolution Operation :: to use the context, like ::PositionsTotal();

It is useful when using two methods with the same name.