Please correct the if condition in the below AFL

#1
Hello,
Could you please correct the error in the below AFL? it shows the errorin second if condition? I am just trying to export the last day data. Thanks
Code:
fmkdir( "d:\\OHLC" );
fh = fopen( "d:\\OHLC\\"+Name()+".csv", "w"); 
if( fh ) 
{ 
   fputs( "Ticker,Date,Time,Open,High,Low,Close,Volume \n", fh ); 
   d = Day(); 
   y = Year(); 
   m = Month(); 
   r = Hour();
   e = Minute();
   n = Second();
   for( i =BarCount -1 ; i >=0; i-- ) 
   { 
     if(d == d[i] ){
 	   fputs( Name() + "," , fh );
      ds = StrFormat("%02.0f-%02.0f-%02.0f,",y[ i ], m[ i ], d[ i ] ); 
      fputs( ds, fh ); 
      ts = StrFormat("%02.0f:%02.0f:%02.0f,",r[ i ],e[ i ],n[ i ] ); 
      fputs( ts, fh ); 
      qs = StrFormat("%.4f,%.4f,%.4f,%.4f,%.0f\n",O[ i ],H[ i ],L[ i ],C[ i ],V[ i ] ); 
      fputs( qs, fh ); 
   } 
	else{
	   break;
	}
} 
  fclose( fh ); 
}
 
Last edited:

Similar threads