MQL4, for cycle, datetime variable problem

 

Hi,

 

I have following code:

 

input string File_Name="DS_SYMBOL_INFO_SCRIPT.csv";
input datetime StartDate=D'2014.09.09 09:00:00';
input datetime EndDate=D'2014.09.12 09:00:00';

 

   for(int i=StartDate; i<=EndDate; i+=86400)
     {
      double array_high[];
      ArraySetAsSeries(array_high,true);
      
      int copied_high;
      string pair=Symbol();

      copied_high=CopyHigh(pair,PERIOD_H1,i,12,array_high);
      Print("copied_high error "+GetLastError());

      //double MaxValue=high_array[ArrayMaximum(high_array, WHOLE_ARRAY,0)];

      FileSeek(Handle,0,SEEK_END);
      FileWrite(Handle,TimeToString(i,TIME_DATE),TimeToString(i,TIME_MINUTES),copied_high);
      FileWrite(Handle,DoubleToString(array_high[5],5));



      // iATR(NULL,0,12,0);

      Print(i+" "+TimeToString(i,TIME_DATE)+" "+TimeToString(i,TIME_MINUTES));
      Print(ArrayRange(array_high,0));
      

     }

 

I have problems with the following line: copied_high=CopyHigh(pair,PERIOD_H1,i,12,array_high);

If i change the "i" to a "0" the script will work.

 

Do i define the time wrong?
Do i have to convert the variable "i" to another type?

 

Thanks for any help!

Br David 

 
It should be a datetime.
 
Thanks.
Reason: