I wish to:"Date","Time","Open","High","Low","Close","Volume",
2018-01-01, 17:01:00, 6405.00, 6409.75, 6401.50, 6407.75, 538
2018-01-01, 17:02:00, 6408.00, 6410.25, 6407.50, 6410.00, 117
2018-01-01, 17:03:00, 6409.75, 6412.00, 6409.50, 6411.25, 101
2018-01-01, 17:04:00, 6411.50, 6412.00, 6411.00, 6411.25, 31
2018-01-01, 17:05:00, 6411.00, 6411.50, 6411.00, 6411.50, 11
(1) read the last row of the file
(2) from the last row, read the data (first comma separated value), and the time (2nd comma separated value)
How can I achieve that?
I tried to device the following indicator code:
Code: Select all
Vars: FileName("");
FileName = "C:\Read123.txt";
Vars:
ListC_ID(ListC.New),
Date_ID(0);
if CurrentBar = 1
then Begin
ClearPrintLog;
// Read entire file ?
Value1 = ListC.ReadFile(ListC_ID, Filename);
// Determine number of rows in the file ?
Value2 = ListC.Count(ListC_ID);
// Read the last value on the file ?
Value3 = ListC.Back(ListC_ID);
// ----------------------------
// Check Output
// ----------------------------
Print("ReadFile: ", Value1);
Print("Count: ", Value2);
Print("Back: ", Value3);
// Clean the List from memory
ListC.Clear(ListC_ID);
end;
ReadFile: 0.00
Count: 8.00
Back: 18.00
Which doesn’t make any sense.
Any advice or help will be truly appreciated!