Download MetaTrader 5
To add comments, please log in or register
Add our Facebook page to friends. Follow the latest news!
jose
71
jose 2015.09.05 08:55 

Hi all,

i have one problem with this code:

 

void write_data()
{
  int handle;
  string filename = Symbol()  + ".csv"; 
  handle = FileOpen(filename,FILE_CSV|FILE_WRITE,',');
  if(handle < 1)
  {
    Print(" #", GetLastError());
    return(0);
    //FileClose(handle);
  }
  
  FileWrite(handle, "DATE","TIME","HIGH","LOW","CLOSE","OPEN","VOLUME","VALUE"); 
  int i;
  for (i=length-1; i>=0; i--)
  {
    FileWrite(handle, TimeToStr(Time[i], TIME_DATE), TimeToStr(Time[i], TIME_SECONDS),
                      High[i], Low[i], Close[i], Open[i], Volume[i],iCustom(NULL,0,"NameIndicator",parameter1,parameter2,parameter3,parameter4,i));
  }
  FileClose(handle);
  return(0);
}

 In column of "VALUE", all is 0.

The values of Open, Close... are all corrects.

What am i having wrong?

Thank you very much 

Keith Watford
Moderator
7947
Keith Watford 2015.09.05 10:18  

Assuming that you have the correct amount of parameters for the iCustom call.

After parameter4 you need to add the buffer index 

Keith Watford
Moderator
7947
Keith Watford 2015.09.05 11:59  
Messi86:

 But only put in csv the latest value. Can be because the market is close?

Possibly. Test it in the strategy tester, You can test indicators now. Files created in the strategy tester by an EA are put in the tester folder, so it is probably the same for indicators.
/
To add comments, please log in or register