Dumping to a csv file problem

 

Hi all,

i am playing dumping info to a csv file and i am wondering several things:

//--- dumping file handler
int handle_file=FileOpen("values.csv",FILE_WRITE|FILE_CSV,","); 

int init()
{
       // Writing file headers
       if(handle_file>0)
       {
            FileWrite(handle_file, 
               "Date",
               "Close"
               );     
       }       
   return(0);
}

int deinit()
{ 
   //-- Close file
   FileClose(handle_file);        
}

int start()
{     
      string date = TimeToStr(Time[1]);
      if(handle_file>0)
       {
        // Writing values
          FileWrite(
            handle_file,
            date,
            Close[1]
          );
       }
   return(0);
}


1. Duplicate last bar of the historical.

2. Wrong data dumping using [0] index. 

 
coiler:

Hi all,

i am playing dumping info to a csv file and i am wondering several things:

Last data on history is: 2014.08.25 


The most recent bar is bar number 0 not 1 . . .  I see nothing in your code to restrict writing duplicate entries to the CSV or even multiple entries to the CSV,  how do you use this script ?  
 
RaptorUK:
The most recent bar is bar number 0 not 1 . . .  I see nothing in your code to restrict writing duplicate entries to the CSV or even multiple entries to the CSV,  how do you use this script ?  


Hi Raptor,
 
i am attaching this EA to the symbol chart which i want to collect data (open price testing mode), to dump indicators values. 

1. Why i have to restrict writing duplicate data to the csv if in my historical (F2) data doesn't have any?.

2. If i change index, [1] by [0] data is wrong (attached image). Why is happening this?. If i dump [0] the Close data is wrong.

Thanks.

Historical

 

Sample. Close[1] dumps the right data. 

 

 
coiler:

Hi Raptor,
 
i am attaching this EA to the symbol chart which i want to collect data (open price testing mode), to dump indicators values. 

1. Why i have to restrict writing duplicate data to the csv if in my historical (F2) data doesn't have any?.

2. If i change index, [1] by [0] data is wrong (attached image). Why is happening this?. If i dump [0] the Close data is wrong.

 

1.  Can't give you an answer,  you didn't post the code . .. just an small snippet in your first post.  If you have the historical data why dump it to CSV ?  just copy it and be done . . .

2. Close[0] is Bid,  Close[0] is never correct unless by chance . . . the correct close for Close[0] is Close[1] once bar 0 has closed and become bar 1.

Reason: