[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 386

 
ikatsko:

Task: compare it with the same one to make sure that there is such an object. Or rather, that there is an object whose part of the name is Triangle


If we introduce a check on "object type", the checks will only be done on "Triangle" objects, which can significantly reduce the sampling cost, eliminating the obviously useless work of checking for "occurrences of string" on "object types" where no such occurrences can be expected in the first place.
 
ikatsko:

How do you get the full name from an object number?



There is a good example in the documentation. Exactly on this subject. https://docs.mql4.com/ru/objects/ObjectName
 
Thank you, I'm sorry, I'm completely lost.
 

How do I open a file to add information to it?

writing:

int handle;
   handle=FileOpen("testname.txt", FILE_READ|FILE_CSV|FILE_WRITE, ';');
   if(handle>0)
   {
      FileWrite(handle, "параметры:");
      ...
      FileClose(handle);
   }

in the deinitialisation function

the text file only stores information about the last run

 
ilunga:

How do I open a file to add information to it?

writing:

In the deinitialization function.

The text file only stores information about the last run

bool FileSeek( int handle, int offset, int origin)
The function moves the file pointer to a new position, which is an offset in bytes from the start, end or current file position. The next read or write occurs from the new position.
If the move of the file pointer was successful, the function returns TRUE, otherwise it returns FALSE. To get information about the error, the function GetLastError() must be called.
Parameters:
handle - File descriptor returned by FileOpen().
offset - Offset in bytes.
origin - The origin position. The value can be one of these constants:
SEEK_CUR - From current position,
SEEK_SET - from beginning,
SEEK_END - from end of file.

  int handle=FileOpen("filename.csv", FILE_CSV|FILE_READ|FILE_WRITE, ';');
  if(handle>0)
    {
     FileSeek(handle, 0, SEEK_END);
     //---- add data to the end of file
     FileWrite(handle, data1, data2);
     FileClose(handle);
     handle=0;
    }
 
 
Vinin:
bool FileSeek( int handle, int offset, int origin)
The function moves the file pointer to a new position, which is an offset in bytes from the start, end or current file position. The next read or write occurs from the new position.
If the move of the file pointer was successful, the function returns TRUE, otherwise it returns FALSE. To get information about the error, the function GetLastError() must be called.
Parameters:
handle - File descriptor returned by FileOpen().
offset - Offset in bytes.
origin - Start position. The value can be one of these constants:
SEEK_CUR - from the current position,
SEEK_SET - from the beginning,
SEEK_END - from the end of the file.

works, thank you.

 
PapaYozh:


Bring here the text from the logbook of the terminal in which the EA does not work.

2011.05.16 09:06:08 Expert Moving Average New-Svecha EURUSD,M30: loaded successfully
2011.05.16 09:04:21 Expert Moving Average New-Svecha EURUSD,M30: loaded successfully
2011.05.16 08:14:25 '81415': DataCenter connecting failed [6]


When the terminal is started and then the EA is running, then nothing else appears in the log, but the EA shows work...

 


index

- Order position or order number depending on the second parameter.
select - Flag of the selection method. It can be one of the following values:
SELECT_BY_POS - the index parameter contains the index number of a position in the list,
SELECT_BY_TICKET - the index parameter contains the ticket number.
pool - Data source for the selection. It is used when the select parameter is equal to SELECT_BY_POS. It can be one of the following values:
MODE_TRADES (default) - order is selected among open and pending orders,
MODE_HISTORY - order is selected among closed and deleted orders.

I absolutely can't understand where and how to take the position order number in the list, if the purpose is to get a profit after the order has been closed? OrderSelect(SELECT_BY_POS,MODE_HISTORY ?

Sorry, am I being too vague?

You can't put in a ticket OrderSelect( tiket,SELECT_BY_TICKET,MODE_TRADES ) for closed and deleted orders?


 
Dimka-novitsek:


index

- Order position or order number depending on the second parameter.
select - Selection method flag. Can be one of the following values:
SELECT_BY_POS - the index parameter passes the ordinal number of the position in the list,
SELECT_BY_TICKET - the number of the ticket is passed in the index parameter.
pool - Data source for the selection. It is used when theselect parameter is equal to SELECT_BY_POS. It can be one of the following values:
MODE_TRADES (default) - order is selected among open and pending orders,
MODE_HISTORY - the order is selected among closed and deleted orders.

I absolutely cannot understand where and how to take the position number in the list, if the purpose is to get a profit after the order has been closed? OrderSelect(SELECT_BY_POS,MODE_HISTORY ?

Sorry, am I being too vague?

After all, we cannot enter the OrderSelect( tiket,SELECT_BY_TICKET,MODE_TRADES ) for closed and deleted orders?


https://docs.mql4.com/ru/trading/ordershistorytotal

 
Sorry, I can't follow the link, it's not working for me.
Reason: