Hi all, I have a problem doing some simple file reading in MQL5, while I was able to do the same pretty fast in MQL4.
Here's the problem. I'm trying to read double and string from a CSV file that looks like this:
0,EURUSD,8.555000000038934,1,0,1.18117,1.1810900000000004,1.18129
Here is the code I'm using to do this. When I try to print the entry or any other double, I get only zeros. When I try to print symbol, I get nothing, only when I compare a symbol to "EURUSD" I get that it actually is EURUSD...
Really don't understand what's the problem..?
if(done==0){ int file = FileOpen("trades.csv",FILE_READ|FILE_CSV,','); if(file<0)Alert("fajl je sjeban"); //Alert(file); int trade_or_not = (int)FileReadNumber(file); string symbole = FileReadString(file,6); double lot = FileReadNumber(file); double order_typer = FileReadNumber(file); double order_direction = FileReadNumber(file); double entry = FileReadNumber(file); double tp = FileReadNumber(file); double sl = FileReadNumber(file); //Alert(trade_or_not); if(StringCompare("EURUSD",symbole)!=0)Print("eurusd je"); Print(entry); done=1; Sleep(10); FileClose(file); }
You agree to website policy and terms of use
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
Hi all, I have a problem doing some simple file reading in MQL5, while I was able to do the same pretty fast in MQL4.
Here's the problem. I'm trying to read double and string from a CSV file that looks like this:
Here is the code I'm using to do this. When I try to print the entry or any other double, I get only zeros. When I try to print symbol, I get nothing, only when I compare a symbol to "EURUSD" I get that it actually is EURUSD...
Really don't understand what's the problem..?