invalid price quotes?

 

I have created a simple MT4 EA that writes the datetime/open/high/low/close values for the GbpUsd to a text file.  The values that MT4 is returning are not accurate. The last record I received is at the bottom of this post.  It shows 1.2462 as the current price but the low for the entire day so far is 1.2546.  How is that possible?


input string             InpSymbolName="GBPUSD";

input ENUM_TIMEFRAMES    InpSymbolPeriod=PERIOD_M1;

input string             InpFileName="GBP.csv";

input string             InpDirectoryName="Data";


void OnTimer()
  {
  datetime time[]; double o[]; double h[]; double l[]; double c[]; datetime date[]; string filename;
//---
   int copied=CopyTime(InpSymbolName,InpSymbolPeriod,0,5000,date);

   ArrayResize(o,copied); ArrayResize(h,copied); ArrayResize(l,copied); ArrayResize(c,copied);

   for(int i=0;i<copied;i++)
     {
      o[i]=iOpen(InpSymbolName,InpSymbolPeriod,i);
      h[i]=iHigh(InpSymbolName,InpSymbolPeriod,i);
      l[i]=iLow(InpSymbolName,InpSymbolPeriod,i);
      c[i]=iClose(InpSymbolName,InpSymbolPeriod,i);
     }

   ResetLastError();
   filename="GbpUsd_" + IntegerToString(Year()) + IntegerToString(Month()) + IntegerToString(Day()) + IntegerToString(Hour()) + IntegerToString(Minute()) + ".csv";
   int file_handle=FileOpen(InpDirectoryName+"//"+filename,FILE_READ|FILE_WRITE|FILE_CSV,",");
      
   //FileWrite(file_handle,"dt,o,h,l,c");
      
      for(int i=0;i<copied;i++)
         FileWrite(file_handle,date[i],o[i],h[i],l[i],c[i]);      

      FileClose(file_handle);
   
  }


datetime open high low close
2019.07.15 09:39:00 1.24619 1.24621 1.2461 1.24621
 
I should have mentioned that the exact same code when ran from a script does produce the correct price quotes.  I do not understand how there could be that much of a difference in a script vs. an EA but the results are not the same.  Any explanation on what I am missing would be greatly appreciated
Reason: