Export quotation data to csv

hi everyone,
when i run below codes, i got -10000000000 result

how can i only store the price that is not null?
thanks!
image

path = "C:\\daily\\";
fh = fopen(path+Name()+".csv", "w" );

if( fh )
{
  fputs("date,open,high,low,close,volume,dividend,split\n", fh );


 
  for( i = 0; i < BarCount; i++ )
  {
  

  	y = Year(); 
 	m = Month(); 
	d = Day(); 
   	ds = StrFormat("%02.0f-%02.0f-%02.0f,", y[ i ] ,m[ i ], d[ i ]); 

    fputs( ds, fh );

    Line = StrFormat("%.4f, %.4f, %.4f, %.4f, %g, %g, %g \n",
    Open[ i ],
    High[ i ],
    Low[ i ],
    Close[ i ],
    Volume[ i ],
    0,
    1
    );
  
	fputs( Line, fh );
  }
 
  fclose( fh );
}
Buy=Sell=0; // for scan
Filter = Status("lastbarinrange");
AddTextColumn("Export done", "Status");

the barcount is 9040, even if the ticker has no so many bars.
image

First the code of post #1 is incorrect!
Arrays do not belong inside BarCount loop.

// these are ARRAYS!
y = Year(); 
m = Month(); 
d = Day(); 

Secondly disable pad&align of Analysis settings

Thanks. After disable pad and align, the output csv is good now!

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.