[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 435

 

Good afternoon all,

I place a pending order (creation time, e.g. 11:31)
then this order is triggered, e.g. at 12:01

Question: how do I know the date and time of creation of a pending order if the order has already entered the market and the OrderOpenTime( ) function returns the time of entering the market.

Maybe someone knows how to solve this problem?

Thanks in advance

 
Please tell me, the smiley smiles but the advisor does not turn on...how do I set it up correctly?...thank you!
 
zorber:

Good day to all,

I place a pending order (creation time, e.g. 11:31)
Then this order triggers at 12:01

Question: How do I know the date and time when the pending order was placed if the order has already entered the market and the OrderOpenTime( ) function returns the time of entering the market.

Does anyone know how to solve this problem?

Thank you in advance.


In MT4 from the list of orders no way.

One way is to remember the time of placing

 
Roger:
It's high time you understood the text file, how it is organized and what it consists of. Unprint the cursor position after each line reading, using the
int FileTell( int handle)
It will become clear at once.

The irony of the situation is that the question I posed above was triggered by a situation that almost corresponds to your advice...

In order to understand how FileIsEnding and FileIsLineEnding functions work, I wrote the following script:

//+------------------------------------------------------------------------------------------+
//|                                                                   Конец_Строки_Файла.mq4 |
//+------------------------------------------------------------------------------------------+
//+------------------------------------------------------------------------------------------+
//|                         script program start function                                    |
//+------------------------------------------------------------------------------------------+
#property show_inputs                                                    //выводим перед запуском скрипта окно свойств
extern int  position=0;                                                  //внешняя переменная: смещение файлового указателя ОТ НАЧАЛА ФАЙЛА (в БАЙТАХ)
//---------------------------------------------------------------------------------------- 1 -
int start()                                                              //функция start
  {                                                                      //начало start
   double Timestart=GetTickCount();                                      //переменная, с помощью которой вычисляется время (в милисекундах) начала выполнения эксперта 
   string name="Копия Запись чисел в файл.csv";                          //имя создаваемого файла
   bool h;                                                               //переменная: значение функции FileIsEnding
   bool h_l;                                                             //переменная: значение функции FileIsLineEnding
   int error;                                                            //переменная: ошибка
   int handle=FileOpen(name,FILE_CSV|FILE_WRITE,';');                    //открываем заданный файл n записываем туда данные
   int запись=FileWrite(handle,DoubleToStr(1.3584,4));                   //записываем число в файл csv (в преобразованном виде, т.е в виде текста)
   FileClose(handle);                                                    //закрываем файл
//---------------------------------------------------------------------------------------- 2 -
   handle=FileOpen(name,FILE_CSV|FILE_READ,';');                         //открываем заданный файл
   bool pos=FileSeek(handle,position,SEEK_SET);                          //смещаем от начала вправо указатель файла
   double чтение=FileReadNumber(handle);                                 //считываем число из текущей позиции (уже измененной функцией FileSeek) файлового указателя
   int size=FileSize(handle);                                            //вычисляем размер заданного файла
   h=FileIsEnding(handle);                                               //устанавливаем текущее значение переменной h
   h_l=FileIsLineEnding(handle);                                         //устанавливаем текущее значение переменной h_l
   error=GetLastError();                                                 //значение ошибки, производимой функцией FileIsEnding
   if(error!=0)Alert("Текущая ошибка ",error);                           //если код текущей ошибки не равен 0, то получаем номер текущей ошибки
   FileClose(handle);                                                    //закрываем файл
//----------------------------------------------------------------------------------------- 3 -
   Comment("Размер файла ",name," составил ",size," байт",
           "\nФункция FileSeek вернула: ",pos,
           "\nФункция FileReadNumber(handle) вернула: ",чтение,
           "\nФункция FileIsLineEnding(handle) вернула: ",h_l,
           "\nФункция FileIsEnding(handle) вернула: ",h,
           "\nСкрипт выполнялся всего ",GetTickCount()-Timestart," миллисекунд, из них: ",MathFloor((GetTickCount()-Timestart)/1000)," секунд ",((GetTickCount()-Timestart)/1000-MathFloor((GetTickCount()-Timestart)/1000))*1000," миллисекунд");//печать сообщения на экран
//----------------------------------------------------------------------------------------- 4 -
   return(0);                                                             //выход из start
  }                                                                       //конец start
//-------------------------------------- КОНЕЦ START -------------------------------------- 5 -

In block 1-2, I opened and wrote the number 1.3584 into the file (which the DoubleToStr function converts to text).

In block 3-4, I opened the file and read the number written there.

The extern int position external variable is supposed to move the file pointer using FileTell function in order to try to understand how FileIsEnding and FileIsLineEnding functions work and what the file pointer is.

The MQL4.community book says that the file pointer is an analogue of the text cursor.

BUT, running the script several times and increasing external variable postiton by 1 each time (i.e., thereby moving the file pointer 1 byte to the right of the beginning of the file), the Comment function outputs a number of messages, e.g:

if postiton=7, the message would look like this:

if postiton=7, the message would look like this:


I understand that since string constants take up 8 bytes in PC memory and there is only 1 converted number in the file, shifting the file pointer 8 bytes to the right will give me a 4099 error (which means that the end of the file has been reached). I also understand that the FileIsEnding function returned 1 (true) for the same reason (file end reached). But I don't understand why the FileIsLineEnding function returned 0 (false, which means that the file pointer has not reached the end of the line). After all, based on the analogy given in the MQL book (a file pointer is roughly the same as a text cursor), I reasoned that the end of the file is also the end of the string. But given that FileIsEnding and FileIsLineEnding have different values when the file pointer reaches the end of the file, I was stumped in terms of WHAT IS A FILE Pointer? But since I had to start somewhere to ask the question, I asked it as it appears on page 433.

So I have a huge request to clear my heated brain and answer the following questions (or at least one that will help me in understanding the rest of the questions):

1. What is wrong with my understanding of the file pointer (the question is given in my post on p.433)

2. The meaning of the phrase "If the specified check (the last 2 lines in block 5-6) is removed, then an extra object will be created at run time.And only after that the while loop end condition will be triggered and control will be transferred to block 8-9" (the question is given in my post on page 433)

3. Why does FileIsLineEnding return 0 instead of 1 when reaching the end of the file.

P.S. In order not to clutter up the forum, thanks in advance for the answer.

 

Good time to all of you

Please tell me how to draw a horizontal line ((Bid+Ask)/2+0.00333):)

 

Good afternoon!

Gentlemen what to do?

The mobile computer can't see the network "NO COMMUNICATION"

 
Ragen:

Good afternoon!

Gentlemen what to do?

The mobile computer can't see the network "NO COMMUNICATION"


create a new demo. the old one must have been deleted due to time constraints.
 
sergeev:

Create a new demo for yourself. the old one must have been deleted due to the deadline

I'm not on a demo, three real accounts.

But all from the same dtz, does that affect anything?

 
Ragen:

I'm not on a demo, three real accounts.

But all from the same dtz, can this affect anything?


:) well, call the brokerage company. what does this have to do with the MQL programming forum?
 
sergeev:

What does this have to do with the MQL programming forum?

For some reason, the terminal was immediately "rolling" :)

I'm on it!