for cycle, beginner Q

 

Hi,

 

what is wrong with following code?

   for(int i=StartDate; i<=EndDate; i+86400)               
     {                                   
     double high_array[12],low_array[];
     int copied;
        
     copied=CopyHigh(Symbol(),PERIOD_H1,i,11,high_array); 
     double MaxValue=high_array[ArrayMaximum(high_array)];


     FileSeek(Handle, 0, SEEK_END);
     FileWrite(Handle,TimeToString(i,TIME_DATE),TimeToString(i,TIME_MINUTES),MaxValue);
     
     
     
     
     // iATR(NULL,0,12,0);
     
     Print(i);
    
                                          
     }  

 

 

I get following  warnings:

1) possible loss of data due to type conversion

2) expression has no effect

 

 

Br David 



 
Davidii111:

Hi,

 

what is wrong with following code?

 

 

I get following  warnings:

1) possible loss of data due to type conversion

2) expression has no effect

 

 

Br David 



Replace i+86400  with i+=86400
 
Wahoo:
Replace i+86400  with i+=86400

Hi, Thanks!

 

When i tried to run

 

   int i;
     
   i=StartDate+86400;
   
   


   Print(i);

 

I succeeded to add, why didnt it succeed in the for expression? 

 

Br David 

 

im still struggling with this code,

 

i have a new problem:

 

   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));
      

     }

 If i replace the "i" in the copied_high=CopyHigh(pair,PERIOD_H1,i,12,array_high); with "0" it works, but if i have the i there it refuses to define the arrays, and i get error code 4054.

 

Can anyone put me in the correct direction here?

Br David 

Reason: