007isrisk: not reading
"Doesn't work" is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
How To Ask Questions The Smart Way. 2004
When asking about code
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked.
We can't see your broken code. We can't see your error codes.
How To Ask Questions The Smart Way. 2004
Be precise and informative about your problem
Fix your broken code.
William Roeder:
Fix your broken code.
//--MQ4 int OnInit() { string c_file_Name="fileFromMQ4.csv"; string c_return=( "file_col_1Handle" +";file_col_2Handle" +";file_col_3Handle" +";file_col_4Handle" +";file_col_5Handle" +";file_col_6Handle" +";file_col_7Handle"); writeNewFile(c_file_Name,c_return); Comment(c_return); return(INIT_SUCCEEDED); } void writeNewFile(string File_Name,string c_log) { int fileToHandle=FileOpen(File_Name,FILE_CSV|FILE_WRITE|FILE_COMMON,";"); // int fileToHandle=FileOpen(File_Name,FILE_CSV|FILE_WRITE|FILE_COMMON,";"); FileWrite(fileToHandle,(c_log)); FileClose(fileToHandle); } void OnTick() { string c_file_Name="fileFromMQ4.csv"; readFileFromMQ4(c_file_Name); } void readFileFromMQ4(string c_File_Name) { // int Handle=FileOpen(c_File_Name,FILE_CSV|FILE_READ|FILE_WRITE|FILE_COMMON,";"); int Handle=FileOpen(c_File_Name,FILE_CSV|FILE_READ|FILE_COMMON,";"); if(Handle<0) { if(GetLastError()==4103) Print("No file named "+c_File_Name); else Print("Error while opening file "+c_File_Name); // return(0); }else { while(!FileIsEnding(Handle)) { string file_col_1=FileReadString(Handle); string file_col_2=FileReadString(Handle); string file_col_3=FileReadString(Handle); string file_col_4=FileReadString(Handle); string file_col_5=FileReadString(Handle); string file_col_6=FileReadString(Handle); string file_col_7=FileReadString(Handle); Print(" file_col_1:: "+file_col_1); Print(" file_col_2:: "+file_col_2); Print(" file_col_3:: "+file_col_3); Print(" file_col_4:: "+file_col_4); Print(" file_col_5:: "+file_col_5); Print(" file_col_6:: "+file_col_6); Print(" file_col_7:: "+file_col_7); if(FileIsEnding(Handle)==true)break; } FileClose(Handle); } }
//--
//--MQ5 int OnInit() { string c_file_Name="fileFromMQ4.csv"; string c_return=( "file_col_1Handle" +";file_col_2Handle" +";file_col_3Handle" +";file_col_4Handle" +";file_col_5Handle" +";file_col_6Handle" +";file_col_7Handle"); //writeNewFile(c_file_Name,c_return); //Comment(c_return); return(INIT_SUCCEEDED); } void writeNewFile(string File_Name,string c_log) { int fileToHandle=FileOpen(File_Name,FILE_CSV|FILE_WRITE|FILE_COMMON,";"); // int fileToHandle=FileOpen(File_Name,FILE_CSV|FILE_WRITE|FILE_COMMON,";"); FileWrite(fileToHandle,(c_log)); FileClose(fileToHandle); } void OnTick() { string c_file_Name="fileFromMQ4.csv"; readFileFromMQ4(c_file_Name); } void readFileFromMQ4(string c_File_Name) { // int Handle=FileOpen(c_File_Name,FILE_CSV|FILE_READ|FILE_WRITE|FILE_COMMON,";"); int Handle=FileOpen(c_File_Name,FILE_CSV|FILE_READ|FILE_COMMON,";"); if(Handle<0) { if(GetLastError()==4103) Print("No file named "+c_File_Name); else Print("Error while opening file "+c_File_Name); // return(0); }else { while(!FileIsEnding(Handle)) { string file_col_1=FileReadString(Handle); string file_col_2=FileReadString(Handle); string file_col_3=FileReadString(Handle); string file_col_4=FileReadString(Handle); string file_col_5=FileReadString(Handle); string file_col_6=FileReadString(Handle); string file_col_7=FileReadString(Handle); Print(" file_col_1:: "+file_col_1); Print(" file_col_2:: "+file_col_2); Print(" file_col_3:: "+file_col_3); Print(" file_col_4:: "+file_col_4); Print(" file_col_5:: "+file_col_5); Print(" file_col_6:: "+file_col_6); Print(" file_col_7:: "+file_col_7); if(FileIsEnding(Handle)==true)break; } FileClose(Handle); } }
string c_file_Name="fileFromMQ4.txt"; int Handle=FileOpen(c_File_Name,FILE_TXT|FILE_READ|FILE_COMMON,";");
i also test with Txt
int fileToHandle=FileOpen(File_Name,FILE_TXT|FILE_WRITE|FILE_COMMON,";");
int Handle=FileOpen(c_File_Name,FILE_CSV|FILE_READ|FILE_COMMON|FILE_ANSI,";");//---this is Working
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
csv file is in common folder