[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 351

 
FAQ:


There is no need to be untyped.

FileReadString() reads to delimiter (if specified). If no delimiter is specified or no existing delimiter is specified, FileReadString() reads to the end of the string (carriage return character). Therefore, in the above example FileFlush() specifies a string length offset .

StrToInteger() in this case selects the first encountered numeric value in the string and converts it to the [int] type.


So why, I use function FileReadString, in theory, should read either the entire string into the variable or up to the separator and a pointer to the separator of the first.

Simply, please show me an example, how can I get all data between separators from a csv file string?

131322608;EURUSD;2;1;0;0;1346149440

 
sss2019:


So why, I use the FileReadString function, in theory, either the entire string into the variable or up to separator and pointer up to separator of the first one should be read.

Simply, please show me an example of how to pull all the data between separators from a csv file line like this?

131322608;EURUSD;2;1;0;0;1346149440


Do you even know how to read? I have described it in detail above.

example :FileOpen (filename,FILE_CSV|FILE_READ,";");

int FileOpen(string filename, int mode, int delimiter=';')
Opens a file for input and/or output. Returns the file descriptor of the opened file or -1 in case of failure. Call GetLastError() to get more information about the error.
Note: files can only be opened in the terminal_directory\experts\files(terminal_directory\tester\files in case of expert testing) folder or its subfolders.
The FILE_BIN and FILE_CSV modes cannot be used simultaneously.
If FILE_WRITE is not combined with FILE_READ, a file with zero length will be opened. Even if there was data in the file before it was opened, it will be destroyed. If data needs to be appended to an existing file, it must be opened using the combination FILE_READ | FILE_WRITE.
If FILE_READ is not combined with FILE_WRITE, the file will only be opened if it already exists. If the file does not exist, it can be created using FILE_WRITE.
No more than 32 files can be opened at the same time within the same executable. Descriptors of files opened in one module cannot be passed to other modules (libraries).
Parameters:
filename - Filename - file name.
mode - Method of opening. This can be a single value or a combination of values: FILE_BIN, FILE_CSV, FILE_READ, FILE_WRITE.
delimiter - A delimiter character for csv files. By default it is ';'.

 
FAQ:


Do not make up your own mind.

FileReadString() reads up to the delimiter (if specified). If no delimiter is specified, or if no existing delimiter is specified, FileReadString() reads to the end of the string (the caretransfer character). Therefore, in the above example FileFlush() specifies a string length offset .

StrToInteger() in this case selects the first encountered numeric value in the string and converts it to the [int] type.


There is no question that it reads before the separator. But the file pointer is at the end of the line. I didn't take the trouble to write a script. That's why I wrote it like this.

//+------------------------------------------------------------------+
//|                                                          111.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   int fileid = FileOpen("File.csv",FILE_CSV|FILE_READ);
    int n1, n2;
      
      string ticket, ticket1;
      
      FileSeek(fileid,0,SEEK_SET);
      
      ticket = FileReadString(fileid);
      Print(ticket," ",FileTell(fileid));
      ticket1= FileReadString(fileid);
      Print(ticket1," ",FileTell(fileid));
      n1= FileReadNumber(fileid);
      Print(n1," ",FileTell(fileid));      
      n2= FileReadNumber(fileid);
      Print(n2," ",FileTell(fileid)); 
//----
   return(0);
  }
//+------------------------------------------------------------------+

The separator, as you can see, is not specified.

06:54:18 111 EURUSD,H1: loaded successfully
06:54:18 111 EURUSD,H1: 131322608 37
06:54:18 111 EURUSD,H1: EURUSD 37
06:54:18 111 EURUSD,H1: 2 37
06:54:18 111 EURUSD,H1: 1 37
06:54:18 111 EURUSD,h1: uninit reason 0
06:54:18 111 EURUSD,H1: removed

 
Mislaid:


06:54:18 111 EURUSD,H1: 131322608 37


StrToInteger() in this case highlights the first encountered numeric value in the string, and converts it to type [int].
 

Hello! There is an object of type OBJ_TREND (i.e. a trend line) constructed using ObjectCreate.

Question: how can I get the NUMBER value that this trend line takes at any point in time, for example at the current moment (Time[0])

 
ikatsko:

Hello! There is an object of type OBJ_TREND (i.e. a trend line) constructed using ObjectCreate.

Question: how can I get the NUMBER value that this trend line takes at any point in time, for example at the current moment (Time[0])


ObjectGetValueByShift()
 
drknn:

ObjectGetValueByShift()

Thank you for your prompt reply?

 
How do I use the SendMail function to send a screenshot made with the WindowScreenshot function ?
 
No, the file can be sent to the FTP
 
FAQ:
No, the file can be sent to ftp

All right, then.

Then I'll come at it from another angle.

Is it possible to make an incoming email to display images from FTP? (i.e. the picture is not an attachment and the email would contain only links to ftp)