CopyTime() always shows a compiling error ("no one of the overloads can be applied to the function call")

 

Hello,

can anyone tell me why this CopyTime() always shows a compiling error?

void OnStart() {
   int bars=Bars(_Symbol,PERIOD_CURRENT);
   MqlDateTime times[];
   ArraySetAsSeries(times,true);
   CopyTime(_Symbol,PERIOD_CURRENT,0,bars,times);
   for (int i=ArraySize(times);i>=0;i--) {
      Print(times[i].mon);
   }
}
 
Marbo :

Hello,

can anyone tell me why this CopyTime() always shows a compiling error?

A little care and everything will work out:

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   int bars=Bars(_Symbol,PERIOD_CURRENT);
//MqlDateTime times[];
   datetime times[];
   ArraySetAsSeries(times,true);
   CopyTime(_Symbol,PERIOD_CURRENT,0,bars,times);
   for(int i=ArraySize(times); i>=0; i--)
     {
      MqlDateTime STimes;
      TimeToStruct(times[i],STimes);
      //Print(times[i].mon);
      Print(STimes.mon);
     }
  }
 
Vladimir Karputov:

A little care and everything will work out:

Great, thank you very much!

Reason: