Download MetaTrader 5
To add comments, please log in or register
Interested in MQL5 features? Find them in documentation!
Komoles Kumar
46
Komoles Kumar 2016.05.20 07:48 
Hi,Coders can anyone fixed warning in return section ?
//+------------------------------------------------------------------+
//| Findoud How much order Open in Trade window                      |
//+------------------------------------------------------------------+
int GetOrderNum()
  {
   string comment;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      bool select=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
        {
         comment=OrderComment();
         break;
        }
     }

   string result[];
   ushort u_sep=StringGetCharacter("_",0);
   int k=StringSplit(comment,u_sep,result);
   return(StringToInteger(result[1]));//  warning this section 
  }
Files:
dcdcdc.JPG 55 kb
Biantoro Kunarto
14806
Biantoro Kunarto 2016.05.20 08:54  

You need to add (int), because the result of StringToInteger command is long type

//+------------------------------------------------------------------+
//| Findoud How much order Open in Trade window                      |
//+------------------------------------------------------------------+
int GetOrderNum()
  {
   string comment;
   for(int i=OrdersTotal()-1;i>=0;i--)
     {
      bool select=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNumber)
        {
         comment=OrderComment();
         break;
        }
     }

   string result[];
   ushort u_sep=StringGetCharacter("_",0);
   int k=StringSplit(comment,u_sep,result);
   return((int)StringToInteger(result[1]));//  warning this section 
  }
Komoles Kumar
46
Komoles Kumar 2016.05.20 12:10  
biantoro kunarto:

You need to add (int), because the result of StringToInteger command is long type

Yes Its working ..... :)  Thank you Biantoro Kunarto.
Biantoro Kunarto
14806
Biantoro Kunarto 2016.05.23 03:33  
komoles:
Yes Its working ..... :)  Thank you Biantoro Kunarto.
You're welcome
/
To add comments, please log in or register