Script Wise CSV Creation -- Amibroker AFL

 Script Wise CSV Creation -- Amibroker AFL


CODE:


fh = fopen( "c:\\AmiBackup\\"+Name()+".csv", "w"); 

if( fh ) 

fputs( "Ticker,Date,Open,High,Low,Close,Volume \n", fh ); 

y = Year(); 

m = Month(); 

d = Day(); 

//r = Hour();

//e = Minute();

//n = Second();

for( i = 0; i < BarCount; 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 ); 


fclose( fh ); 


Buy = 0;









0 comments:

Post a Comment