Problem with Export to csv script

 

/*----------------------------------------------------------------|
// Indicator Export Expert v1, by juanchoc & neo |
//----------------------------------------------------------------|
// |
// |
// This EA was made to easily export indicators results |
// to CSV files for further manipulation and/or analisis |
// of them. |
// |
// Instructions: |
// Modify the InitializeHeaderFile() function so that it |
// displays the CSV column headers in the same order |
// you set the indicators. |
// Modify the WriteHistoryData() function so that it |
// displays the indicators you want to export (remember |
// to place them on the same order you used on the |
// InitializeHeaderFile()). |
// Compile the expert. |
// Run the expert on the desired time range using the |
// Strategy Tester. |
// Results are saved at your MetaTrader/tester/files/ |
// folder. |
// |
// |
// ***PLEASE DONT MODIFY OR DELETE THIS HEADER** |
// Copyright 2006, by juanchoc & neo. |
// juan@forexproyect.com.ar |
//---------------------------------------------------------------*/

#property copyright "#copyright#"
#property link      "#link#"

#include <WinUser32.mqh>

int      CSVHandle = -1;


int OpenHistoryFile()
{
   string name;
   
   name = Symbol() + "_DATA";
      CSVHandle = FileOpen(name + ".csv", FILE_CSV|FILE_WRITE, ',');
      if (CSVHandle < 0) return(-1);
   return (0);
}

int InitializeHeaderFile()
{
      FileWrite(CSVHandle,
         "DATE",
         "TIME",
         "OPEN", 
         "HIGH", 
         "LOW", 
         "CLOSE", 
         "VOLUME",
         "SMA_CLOSE_20",
         "EMA_CLOSE_20",
         "SMMA_CLOSE_20",
         "LWMA_CLOSE_20",
         "ATR",
         "CCI"
         );

}

static double d_open, d_low, d_high, d_close, d_volume;
static int i_time;

void WriteHistoryData()
{

   if (CSVHandle >= 0) {
      int i_digits = Digits;
      
      FileWrite(CSVHandle,
         TimeToStr(Time[0], TIME_DATE),
         TimeToStr(Time[0], TIME_MINUTES),
         DoubleToStr(Open[0], i_digits), 
         DoubleToStr(High[0], i_digits), 
         DoubleToStr(Low[0], i_digits), 
         DoubleToStr(Close[0], i_digits), 
         Volume[0],
         iMA(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,0),
         iMA(NULL,0,20,0,MODE_EMA,PRICE_CLOSE,0),
         iMA(NULL,0,20,0,MODE_SMMA,PRICE_CLOSE,0),
         iMA(NULL,0,20,0,MODE_LWMA,PRICE_CLOSE,0),
         iATR(NULL,0,20,0),
         iCCI(NULL,0,20,PRICE_CLOSE,0)
         );
   }
}

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   OpenHistoryFile();
   InitializeHeaderFile();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
      if (CSVHandle >= 0) {
      FileClose(CSVHandle);
      CSVHandle = -1; 
   }

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   WriteHistoryData();
//----
   return(0);
  }
//+------------------------------------------------------------------+

Compilation successfull, but the .csv file doesn't create in metatrader/tester/files directory. Any ideas, where could be the problem?

Regards, Mindaugas.

 

Figured out, partly....

The problem somehow is with windows 7, no problem getting .csv file when using xp