problem with mq1rates

 

Hello,

I need help to solve an error in my code ;


double rates[];

datetime start_time="20:00:00";
datetime stop_time="05:00:00";

int  CopyRates(
   string           symbol_name,       // symbol name
   ENUM_TIMEFRAMES  PERIOD_M15,         // period
   datetime         start_time,        // start date and time
   datetime         stop_time,         // end date and time
   MqlRates         rates[]      // target array to copy

   );


error : Mq1rates objects are passed by reference only

 

Check out the example in the documentation

MqlRates rates[]; 
   ArraySetAsSeries(rates,true); 
   int copied=CopyRates(Symbol(),0,0,100,rates); 
   if(copied>0) 
     { 
      Print("Bars copied: "+copied); 
      string format="open = %G, high = %G, low = %G, close = %G, volume = %d"; 
      string out; 
      int size=fmin(copied,10); 
      for(int i=0;i<size;i++) 
        { 
         out=i+":"+TimeToString(rates[i].time); 
         out=out+" "+StringFormat(format, 
                                  rates[i].open, 
                                  rates[i].high, 
                                  rates[i].low, 
                                  rates[i].close, 
                                  rates[i].tick_volume); 
         Print(out); 
        } 
     } 
   else Print("Failed to get history data for the symbol ",Symbol()); 
  }
 

Reason: