Errors, bugs, questions - page 897

 
Rugyi_cool:
Please tell me how to create a poll on the forum?

Where a new topic there is a small arrow, click on it and comes out"new poll" choose.


survey

 
Zeleniy:

Where a new topic is, there is a small arrow, click on it and"new poll" comes up.



Thanks so much for the tip!!!!!!!!!!!
 
Could you please tell me how to change to read data on a new line, I can't find the command to move the cursor to a new line, thanks
Документация по MQL5: Основы языка / Типы данных / Целые типы / Символьные константы
Документация по MQL5: Основы языка / Типы данных / Целые типы / Символьные константы
  • www.mql5.com
Основы языка / Типы данных / Целые типы / Символьные константы - Документация по MQL5
 
lazarev-d-m:
Can you please tell me how to move to read data on a new line, I can't find the command to move the cursor to a new line, thanks
FileSeek().
 
tol64:
FileSeek().

Am I correct in assuming that this function can only move the cursor by reading characters from the beginning of the file? How can it move the cursor to a new line in a file like this

Um... no csv file. I'll convert it to txt.

made it look like it's opening a csv with a text editor.

Files:
News.txt  1 kb
 
lazarev-d-m:
move the cursor to a new line in the file
What is a new line in a file? Does a file have lines? It's linear.
 
sergeev: does a file have str ings?

FILE_LINE_END

Get end ofline flags

 
sergeev:
What is a new line in a file? Does a file have lines?

So, according to my file layout, to go from line 95 to line 96, I need to know the number of files in the line and count the number of variables =(95*(number of values in the line)+1)

Is that how it works? It just looks easy, if I need all values in file, but I need csv file for archive of current and future news, and I need to think over mechanism of rows search, that data corresponds to criteria, for example only 95 line has all data that meet my requirements (EURUSD;2012;12;15;12;30) - if this line is found, then trade is allowed, etc.

 
lazarev-d-m:

So, according to my file layout, to go from line 95 to line 96, I need to know the number of files in the line and count the number of variables =(95*(number of values in the line)+1)

Is that how it works? It just looks easy, if I need all values in file, but I need csv file for archive of current and future news, and I need to think over mechanism of lines searching, that data will correspond to criteria, for example only 95 line has all data that meet my requirements (EURUSD;2012;12;15;12;30) - if such line is found, I am allowed to trade, etc.

Read all the file operations carefully. It has everything you need to navigate in the file.

Try to experiment with this example:

void CountStrings()
  {
   int handle=-1;
   string txt_string="";
   ulong tell_seek=NULL;
//---
   string nm_file="Experiments\Hello.csv";
//---
   handle=FileOpen(nm_file,FILE_READ|FILE_CSV|FILE_ANSI);
//---
   if(handle!=INVALID_HANDLE)
     {
      string s="";
      ulong tseek=0;
      int cnt_Strings=0; // Счётчик строк
      //---
      // Читать пока текущее положение файлового указателя не окажется в конце файла
      while(!FileIsEnding(handle))
        {
         if(_StopFlag) { return; }
         //---
         while(!FileIsLineEnding(handle)) // Считаем всю строку
           {
            if(_StopFlag) { return; }
            //---
            FileReadString(handle);
            //s=FileReadString(handle); Print("s: ",s);
            //---
            tell_seek=FileTell(handle); // Получим положение указателя
            //---
            if(FileIsLineEnding(handle))
              {
               Print("Это конец строки! ",tell_seek);
               //---
               // Переход на другую строку, если это не конец файла
               if(!FileIsEnding(handle)) { tseek=tell_seek+1; }
               //---
               FileSeek(handle,tseek,SEEK_SET); cnt_Strings++;
               //---
               break;
              }
           }
         //---
         if(FileIsEnding(handle)) { Print("Это конец файла! Всего строк: ",cnt_Strings); break; }
        }
      //---
      FileClose(handle);
     }
  }

//---

There are quite a few examples in the Help, code base and articles too. All you need to do is to take it and use it. ))

 
Yedelkin:

FILE_LINE_END

Getting end ofline sign

I more or less figured it out, the terminal sees a csv file not as a table but as a usual file where all variables are lined up and separated by a separator, and to orientate in it as in a table, I wrote a little sample script to work with csv as with a table, from a human point of view, as strange as it may sound, today / tomorrow I will throw in CodeBase, I think many will be interesting