Afl code to write amibroke chart value to an text file

rlmb

New Member
#1
Hello,

I am new to amibroker afl code, So any one help me to write value from amibroker chart to a text file, for every tick.

Thanks & Regards,

Boopathi.R
 

mastermind007

Well-Known Member
#2
Hello,

I am new to amibroker afl code, So any one help me to write value from amibroker chart to a text file, for every tick.

Thanks & Regards,

Boopathi.R
You can run this a scanner/explorer.

Code:
fmkdir( "C:\\AMIOUTPUT" );

//Enter your choice of dates here. It is not DateTime?
Buy = ( (DateNum() >= 1061225) AND (DateNum() <= 1070110) );

for( i = 0; i < BarCount; i++ )
{
if( Buy[i] )
{
  fh = fopen( "C:\\AMIOUTPUT\\"+Name()+".txt", "a"); 
  if( fh ) 
   { 
     y = Year(); 
     m = Month(); 
     d = Day(); 
     r = Hour();
     e = Minute();
   
   for( i = 0; i < BarCount; i++ )
   if( Buy[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,", 
                     r[ i ],e[ i ]); 
      fputs( ts, fh ); 

      qs = StrFormat("%.2f,%.2f,%.2f,%.2f,%.0f\n", 
                     O[ i ],H[ i ],L[ i ],C[ i ],V[ i ] ); 
      fputs( qs, fh );
   }
   fclose( fh );
   }
}
}
 

Similar threads