Errors, bugs, questions - page 395

 

OnInit works strangely in the indicator. If terminal is started after long inactivity (several hours), EventSetTimer returns false, error 4102. If I restart the terminal or just change timeframe, it starts working. How do I fight it?

 
AlexeyFX:

OnInit works strangely in the indicator. If terminal is started after long inactivity (several hours), EventSetTimer returns false, error 4102. If I restart the terminal or just change timeframe, it starts working. How do I fight it?

Multiple attempts to set the timer (e.g. in a loop) since ERR_CHART_NO_REPLY(4102) is possible, especially on terminal upswing.
Документация по MQL5: Работа с событиями / EventSetTimer
Документация по MQL5: Работа с событиями / EventSetTimer
  • www.mql5.com
Работа с событиями / EventSetTimer - Документация по MQL5
 

Question for the developers. Previously, in the properties of the indicator in the "Apply to" menu, in addition to everything else listed, you could select "data of the first indicator". Now it is not possible to do this:

Is it removed for some reason?

 
Can you please tell me how FileReadString() function moves file pointer when reading from .csv file ? When I read one character, the pointer is shifted 142 characters to the right - beyond the end of the file. If you need, I can lay out the code.
Документация по MQL5: Файловые операции / FileReadString
Документация по MQL5: Файловые операции / FileReadString
  • www.mql5.com
Файловые операции / FileReadString - Документация по MQL5
 
molotkovsm:
Please tell me how FileReadString() moves the file pointer when reading from a .csv file

When reading any file with any function, the pointer is moved to the number of bytes read.

 
sergeev:

when reading any file with any function, the pointer moves by the number of bytes read.


Then tell me what I'm doing wrong, the pointer is shifted wrong, here is the code

void OnStart()
  {
int file_handle;
int value1;
int value2;
   file_handle=FileOpen("file01.csv", FILE_READ|FILE_CSV);
   value1=StringToInteger(FileReadString(file_handle));
   Print(value1,"     ",FileTell(file_handle));
   value2=StringToInteger(FileReadString(file_handle));
   Print(value2,"     ",FileTell(file_handle));
   FileClose(file_handle);
  }

The following lines appear in the log

2011.05.24 21:44:06 read_test (EURUSD,M1) 1 142

2011.05.24 21:44:06 read_test (EURUSD,M1) 0 286

file01.csv file contents:

1;2;3;5;1.41299999;1.41250002;1.41199994;1.41149998;2011.05.24 17:23;5


 
add FILE_ANSI
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы ввода/вывода / Флаги открытия файлов
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы ввода/вывода / Флаги открытия файлов
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы ввода/вывода / Флаги открытия файлов - Документация по MQL5
 
sergeev:

add FILE_ANSI

added:

file_handle=FileOpen("file01.csv", FILE_READ|FILE_CSV|FILE_ANSI);

the result has changed, but still not the one you expect - the second line has only changed

2011.05.24 22:01:32 read_test (EURUSD,M1) 1 142
2011.05.24 22:01:32 read_test (EURUSD,M1) 0 288


 
molotkovsm:

added:

the result has changed, but it's still not what it looks like - the second line has only changed


You didn't set delimiter. It defaults to '\t'.

and you're looking for ';'.

 
sergeev:

You didn't set a delimiter. The default delimiter is '\t'.

and I see you need ';'.

Added delimiter, without FILE_ANSI it seems to work, thanks for the help.

Документация по MQL5: Стандартные константы, перечисления и структуры / Константы ввода/вывода / Флаги открытия файлов
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы ввода/вывода / Флаги открытия файлов
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы ввода/вывода / Флаги открытия файлов - Документация по MQL5
Reason: