I have an indicator that I use in an EA, which does its calculations using many symbols, which means that while optimizing the EA, the indicator gets different results than on live.
So what I'm trying to do is export the live indicator buffer to a csv file, which I was able to do, and then have another indicator import them, instead of doing the calculations.
I exported them in the following format Time[i];Buffer[i] to the csv, but I wonder how I could import them correctly.
Here's my current code, but I want to know how to get the second value of the row:
PrintFormat("%s file is available for writing",InpFileName);
PrintFormat("File path: %s\\Files\\",TerminalInfoString(TERMINAL_DATA_PATH));
//--- read data from the file
if(Time[i] == StringToTime(FileReadString(file_handle,0))
PrintFormat("Data is written, %s file is closed",InpFileName);
PrintFormat("Failed to open %s file, Error code = %d",InpFileName,GetLastError());
"ChangeofChange" is the buffer of course.
My problem is here:
I need to assign to it the second value of the csv rows
I don't use MQ's csv-file options!
ushort SepLine = StringGetCharacter("\n",0),
SepItem = StringGetCharacter(";",0);
int hdl = FileOpen(fName,FILE_READ|FILE_SHARE_READ|FILE_BIN|FILE_COMMON),
sz = (int)FileSize(hdl),
string lines,cells,all = FileReadString(hdl,sz);
nL = i = StringSplit(all,SepLine,lines);
To me this way is a lot easier to handle and to manage with less code.