Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 410

 
artmedia70:
This means that there are no requotes in the tester. It means there is an error in the trade order. Most likely, you are trying to open a market order as a pending one.

No, there are no pending orders. What is a requote?
 
Trader7777:
No, there are no pending orders. What is a requote?
It is when the price moves beyond the allowable slippage during an attempt to open a market position. The tester does not show it, which means that we are trying to open a position not at Bid or Ask, but at some unknown price.
 

Good afternoon, I have a question about writing data to files.

Can you please tell me why in FILE_READ|FILE_WRITE mode, when I try to write to a file, it is writing over the old file, but not appending to it?

Note, it's not opening a new empty file and filling it (like in FILE_WRITE mode), but overwriting it - i.e. if less events to be written occurred during the last Soviet run than during the penultimate one, the last but one run's remnants would hang at the end of the file.

file_log = "expert_" + magic_number + "_log.csv";
handle_log = FileOpen(file_log, FILE_CSV|FILE_READ|FILE_WRITE, ',');
if(handle_log < 0)  {
  Alert("Ошибка при открытии файла ", file_log, "Возможно, файл занят другим приложением.");
  PlaySound("alarm.wav");
}
else  {
  if(FileWrite(handle_log, "time", "ticket", "type", "openprice", "stoploss", "takeprofit", "lot", "closeprice", "effect_points", "деньги советника") < 0  ||    // это заголовки
      FileWrite(handle_log, TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS), "Советник открыт с параметром delta=", delta) < 0)  {   // для отраж-я возмож. изм-я параметра при рестарте
    Alert( "Ошибка записи в файл ", file_log, " ошибка-", GetLastError() );
    PlaySound("alarm.wav");
  }
}

The file is opened and the first record (shown above) is made in init. At start, the working records are added to the file according to the events in turn. The file is closed in deinit.

 
yan720:

Good afternoon, I have a question about writing data to files.

Please tell me why in FILE_READ|FILE_WRITE mode when you try to write into file, it writes over old file, but not appending to it?

Note, it's not opening a new empty file and filling it (like in FILE_WRITE mode), but overwriting it - i.e. if less writable events occurred during the last Soviet run than during the penultimate one, the last but one run's remnants would hang at the end of the file.

The file is opened and the first record (shown above) is made in init. At start, the working records are added to the file according to the events in turn. The file is closed in deinit.

If I'm not mistaken, there should be only two options in the open file function, but you have three: "FILE_CSV|FILE_READ|FILE_WRITE".

You have no function that closes the file, so the data is not saved.

And at the end, you can add a record cursor to go to the very end when adding a new one

 
yan720:

Good afternoon, I have a question about writing data to files.

Can you please tell me why in FILE_READ|FILE_WRITE mode, when I try to write to a file, it is writing over the old file, but not appending to it?

Note, it's not opening a new empty file and filling it (like in FILE_WRITE mode), but overwriting it - i.e. if less events to be written occurred during the last Soviet run than during the penultimate one, the last but one run's remnants would hang at the end of the file.

The file is opened and the first record (shown above) is made in init. At start, working records are added to the file according to the events in turn. The file is closed in deinit.


Have you tried going to the end of the file to write?
 
Vinin:

Have you tried going to the end of the file to write it?

Hmmm... Makes sense... :) Thank you.

But how...? I didn't see that in the description of the language's file functions. Read all you have in it through while(!FileIsEnding(handle_log)) or is there a more "direct" way?

 
yan720:

Hmmm... Makes sense... :) Thanks.

How...? I didn't see any such thing in the description of the language's file functions. Read everything in it via while(!FileIsEnding(handle_log)) or is there a more "direct" way?


FileSeek()
 
Vinin:

FileSeek()

Thank you.
 
yan720:

Hmmm... Makes sense... :) Thank you.

But how...? I didn't see that in the description of the language's file functions. Is there a more "direct" way to read everything in it through while(!FileIsEnding(handle_log)) or is there?


Oh great... I'm certainly glad that the problem is solved, but for some reason you didn't notice my message, where I said the same thing, with slightly different words, and immediately told about defects, except for closing the file, I did not immediately see where it happens:)
 
Ekburg:

Well, hello... I am of course glad that the problem is solved, but for some reason you have not noticed my message, where I said the same thing, with slightly different words, and immediately said the defects, except closing the file, did not immediately see where you have it:)

About the book did not say where to send?