Download MetaTrader 5

Fileopen ==> "1"

To add comments, please log in or register
cape1354
185
cape1354  

I want to import data(EURGBP30) through the fileopen function instead of history center

EURGBP30


2012.02.27,10:00,0.84648,0.84669,0.84609,0.84664,1639
2012.02.27,10:30,0.84663,0.84724,0.84633,0.84667,1773
2012.02.27,11:00,0.84666,0.84712,0.84569,0.84580,1651
2012.02.27,11:30,0.84579,0.84589,0.84468,0.84477,1959
2012.02.27,12:00,0.84477,0.84528,0.84444,0.84461,1729

.

The code below shows "1" outputs. Where is it wrong?





int fileHandle;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//---
   {


   fileHandle = FileOpen("EURGBP30.csv",FILE_CSV|FILE_READ, ',');
   if(fileHandle < 0){
   Alert("Error ", GetLastError());
   }


return(0);
}
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//---{

return(0);
}
   
  
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
  Print(fileHandle);
  }
  
  
  
  
//+------------------------------------------------------------------+



Carl Schreiber
7301
Carl Schreiber  

The handle if the file has the value 1 so thefile was opened correctly but as I see not closed - bad idea!!

What if you place the cursor above FileOpen and press F1 and start reading ..?

To add comments, please log in or register