I hope you are in best of health.
Could you please help me read a csv file into an array.
Example of a csv file(one line)
2008.01.01 22:30;1;146;1;ALL;000000000;22:30 AUD L "AIG Manufacturing Index" 6564;A: 57.6 | P: 53.8
each column is separated by a semicolon. first one is datetime; others include currency, News event name, impact etc.
Metatrader has built in csv mode in it.
Code: Select all
handle = FileOpen(FileName, FILE_CSV|FILE_READ,';'); // Open NEWS.CSV
if(handle==0) Comment("File "+FileName+" not found.");
for(eCount = 0; !FileIsEnding(handle); eCount++) { // Read from NEWS.CSV; one line per event
eTime[eCount] = StrToTime(FileReadString(handle)); // Event date/time
eNumber[eCount] = StrToInteger(FileReadString(handle)); // Event seq# (same date/time have ascending seq#s)
eWingding[eCount] = StrToInteger(FileReadString(handle)); // Wingding code denoting implicated currency
eImpact[eCount] = StrToInteger(FileReadString(handle)); // Impact: 1=low; 2=medium; 3=High
eCurrency[eCount] = FileReadString(handle); // Currency/ies on whose charts object will display; ALL = all currencies
ePeriods[eCount] = FileReadString(handle); // Time period settings on which object will display (M1,M5,M15,M30,H1,H4,D1,W1,MN; 0=no, 1=yes)
eText1[eCount] = FileReadString(handle); // First line of description
eText2[eCount] = FileReadString(handle); // Second line of description
Please provide a solution. It would mean a lot to me.
regards,
Sheraz