// Downloaded From https://www.WiseStockTrader.com
/*
Export intraday and EOD data to TXT files 
*/

fh = fopen( "c:\\SaveData\\"+Name()+".txt", "w"); 
if( fh ) 
{ 
   fputs( "Ticker,Date,Time,Open,High,Low,Close,Volume \n", fh ); 
   y = Year(); 
   m = Month(); 
   d = Day(); 
   r = Hour();
   e = Minute();
   n = Second();
   index = BarCount - 420;
   if(index > 0)
   {
    for( i = index; 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 ); 
    } 
   }
   else {
    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;