Help needed - Export minute data to hourly OHLC

#1
Dear forum,

I need help in exporting nifty 1 minute data to hourly OHLC data. I am not a programmer, so please excuse me if it looks stupid. Currently I am using the code below.

Thank you again.
M
Code:
fmkdir( "C:\\AmiBackupD" );
Buy = Status( "barinrange" );

//if we want to export data for a single Day, we modify the Second line like this
//Buy = ( (DateNum() == 1070129));

for( i = 0; i < BarCount; i++ )
if( Buy[i] )
{
  fh = fopen( "C:\\\AmiBackupD\\intraday.csv", "a");//if we want to export all data in a single file//
  //fh = fopen( "C:\\AmiBackupD\\"+Name()+".csv", "a");// if we want to export data in an individual file//
  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("%g,%g,%g,%g,%1.0f,%1.0f\n",
                     O[ i ],H[ i ],L[ i ],C[ i ],V[ i ],OI[ i ] );
      fputs( qs, fh );

   }
   fclose( fh );
   }
}
 

Similar threads

Zerodha – Open Paperless Account

Open online account with Zerodha. Free delivery trading and Max Rs 20 for Intraday, F&O, Currency and Commodity Trading. Intraday High leverage with MIS, CO and BO.

Name:Phone:
Email:City:
State:
Are you a day trader?