How to remove the warnings ?

 

Hello,

How to remove the warnings ?

'Sample.mq4'    Sample.mq4      1       1
implicit conversion from 'number' to 'string'   Sample.mq4      48      22
implicit conversion from 'number' to 'string'   Sample.mq4      48      38
0 error(s), 2 warning(s)                1       3

//+------------------------------------------------------------------+
//|                                                       Sample.mq4 |
//|                                         Copyright 2014, Pierre8r |
//|                                              https://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, Pierre8r"
#property link      "https://www.mql4.com"
#property version   "1.00"
#property strict
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   int i,limit;
   ArraySetAsSeries(time,false);

   limit=prev_calculated-1;
   if(limit<0)
     {
      limit=0;
     }

//--- main loop
   for(i=limit; i<rates_total && !IsStopped(); i++)
     {
      Print("Time :"+time[i]+"   i:"+i);
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
 
Print("Time :"+(string) time[i]+"   i:"+ (string) i);
 
tintin92:

Hello,

How to remove the warnings ?

Yes, as GumRai wrote, to remove warnings about implicit conversion, you have to do an explicit conversion. An other way :

      printf("Time :%s   i:%i",TimeToString(time[i]),i);
 
Thanks all, I keep the answer from angevoyageur.
 
angevoyageur:

Yes, as GumRai wrote, to remove warnings about implicit conversion, you have to do an explicit conversion. An other way :



If it is not too complicated, can you explain what

%s i:%i

does?

 
 


Thanks for that :)

You really would think that by putting % in the reference index, that it would at least give a pointer to that :(

Reason: