Can someone please tell me what this code reads from the hst file?

 

Can someone please tell me what this code reads from the hst file?


    datapath=TerminalInfoString(3)+"\\history\\"
                  +account_server+"\\"+Symbol()+"240"+".hst";
      ReadFileHst(datapath);
   
      
   static datetime previousBar;
   if(previousBar!=Time[0]) {
      previousBar=Time[0];
      ChartRedraw();
   } else {
      return;
   }

   //**********************************

   if(!BytesToRead>0)
      return;

   int pos = -1 ;
   for(int i = 0 ; i < BytesToRead - 1 ; i++) {
      if(!(data[i][0]<Time[0]))
         break;
      pos = i + 1;
   }



   double level=NormalizeDouble(data[pos][1],Digits);


void ReadFileHst(string FileName) {
   int       j=0;;
   string    strFileContents;
   int       Handle;
   int       LogFileSize;
   int       movehigh[1]= {0};
   uchar     buffer[];
   int       nNumberOfBytesToRead;
   int       read[1]= {0};
   int       i;
   double    mm;
//----- -----
   strFileContents="";
   Handle=CreateFileW(FileName,(int)0x80000000,3,0,3,0,0);
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
   if(Handle==-1) {
      Comment("");
      return;
   }
   LogFileSize=GetFileSize(Handle,0);
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
   if(LogFileSize<=0) {
      return;
   }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
   if((LogFileSize-148)/60==BytesToRead) {
      return;
   }
   SetFilePointer(Handle,148,movehigh,0);
   BytesToRead=(LogFileSize-148)/60;
   ArrayResize(data,BytesToRead,0);
   nNumberOfBytesToRead=60;
   ArrayResize(buffer,60,0);
   for(i=0; i<BytesToRead; i=i+1) {
      //+------------------------------------------------------------------+
      //|                                                                  |
      //+------------------------------------------------------------------+
      ReadFile(Handle,buffer,nNumberOfBytesToRead,read,NULL);
      if(read[0]==nNumberOfBytesToRead) {
         result=StringFormat("0x%02x%02x%02x%02x%02x%02x%02x%02x",buffer[7],buffer[6],buffer[5],buffer[4],buffer[3],buffer[2],buffer[1],buffer[0]);

         m_price.buffer[0] = buffer[32];
         m_price.buffer[1] = buffer[33];
         m_price.buffer[2] = buffer[34];
         m_price.buffer[3] = buffer[35];
         m_price.buffer[4] = buffer[36];
         m_price.buffer[5] = buffer[37];
         m_price.buffer[6] = buffer[38];
         m_price.buffer[7] = buffer[39];
         mm=m_price.close;
         data[j][0] = StringToDouble(result);
         data[j][1] = mm;
         j=j+1;
         strFileContents=TimeToString(StringToTime(result),3)+" "+DoubleToString(mm,8);
      }
      else {
         CloseHandle(Handle);
         return;
      }
   }
   CloseHandle(Handle);
   strFileContents=DoubleToString(data[j-1][0],3)+" "+DoubleToString(data[j-1][1],8)+" "+DoubleToString(data[j-2][1],3)+" "+DoubleToString(data[j-2][1],8);
   result=strFileContents;
}
 

Seems obvious to me: historical prices. I am not privy to the language of the hst file, however, I know that the hst file contains either time stamps for ticks and the order of prices recieved on each tick. and given that the buffer lines start with m_price, that also suggests something to do with chart prices. 

If you want me to be more specific on what is being read, then you will need to upload the full code/script, as the above appears to be just a snippet. Maybe more lines will tell me more.