Errors, bugs, questions - page 2233

 
A100:

And you can not remove - because it is the code of the EA or do you want to understand thousands of lines of other people's code is irrelevant - which results in only a time delay?

Perform the task I gave you above and report to the public about the results.

Why should I repeat mistaken code???? Why would I want to use some unknown .ex file????

If there is an error opening file with flags FILE_SHARE_READ|FILE_SHARE_WRITE be kind and reproduce these problems without extraneous, artificially created errors.

 
Alexey Viktorov:

Why would I want to repeat an erroneous code???? Why would I want to chain some unknown .eh file to????

If there is an error opening a file with FILE_SHARE_READ|FILE_SHARE_WRITE flags, please reproduce these problems without extraneous, artificially created errors.

What makes you think the code is wrong?

The way I can report you about errors is the same, and .ex file is not for you, but for developers. If you want to help with a simple reproduction of the error you can use my advice, if you do not want to help, do not bother others with empty angry posts

 
A100:

What makes you think the code is wrong?

The way I can report the error is the way I do it. I did not write the .ex file for you, but for developers. If you want to help with simple reproduction of the error you can use my advice, if you do not want to help, do not bother others with empty angry posts

Your posts are more like malicious. My request

Forum on trading, automated trading systems and strategy tester

Bugs, bugs, questions

Alexey Viktorov, 2018.07.23 14:16

Strange that it doesn't help. I was only able to get 5004 without the FILE_SHARE_WRITE flag

The file in the write advisor opens at OnInit and closes only at OnDeinit. At the same time, in the read advisor, the file reads and prints without any problems.

It would be good to clarify how you write the file in order to replicate your actions more accurately.


Wasn't addressed to you, but you stuck up and slipped in posts from two years ago, which the developers didn't pay attention to, in my opinion, because of an artificially created error.

And I repeat: Why should I reproduce an artificially created error???????????

 
Alexey Viktorov:

And once again: Why should I reproduce an artificially created error???????????

Explain what an artificially created error is? I don't understand this phrase
 
TheXpert:

Try after opening a file for writing (part 1 of the code) to view it with Windows viewer. at least it will be clear which handle is the problem.

If it opens - the second one, if not - the first one.

Windows will open the first file. I see at system level that the read, write, share_read flags are set. But in the terminal, opening the same file for reading produces 5004. The first Expert Advisor writes to the file, i.e. it is not just opened with some flags for fun.

When I have time, I will try to make a script for demonstration. But judging by the fact that this is not the first one I have written about it and there are no developments related to files in the code, the curvature is present.

PS. Maybe who already wrote in SD? What are the answers?

 
A100:
Strictly speaking, the error is caused by simultaneous call ofFileOpen( filename ) from different Expert Advisors (flags do not matter)
the flag FILE_SHARE_READ actually means non-exclusive read access, at least in the winapi original
 
Stanislav Korotky:

Windows opens the first file.

The second Handle wants exclusive read access or other unauthorised access, despite the flag.
 
A100:
Explain what an artificially created error is? I don't understand this phrase.

There's no subtext in what I'm saying. You must understand what artificial leather is. Refer to that understanding.

Show code without additional manipulation with templates and other tambourines, which returns error ERR_CANNOT_OPEN_FILE with FILE_SHARE_READ|FILE_SHARE_WRITE flags

If the error is not reproduced without tambourines, it means the error was caused during the tambourines...

I'll repeat the sequence of actions:

EA 1:

In OnInit a binary file is opened for writing.

Every minute writes the opening of the current bar to the file.

The file is closed ONLY at OnDeinit.

Expert Advisor 2:

Every minute opens this binary file.

Reads the last entry, prints it.

Closes the file.

And repeats this every minute.


There are no file opening errors.

 

On this simple script, run first with writing = true and then on another chart with writing = false, I get an error.

#property script_show_inputs

input bool writing = false;

int OnStart()
{
  int handle = FileOpen("xyz.foo", FILE_READ|FILE_BIN|FILE_SHARE_READ|(writing?FILE_WRITE:0));
  if(handle == INVALID_HANDLE)
  {
    Print("FileOpen failed: ", GetLastError());
    return INIT_FAILED;
  }
  
  if(writing) FileWriteInteger(handle, 0);
  
  Print("handle=", handle);
  
  while(!IsStopped())
  {
    Sleep(1000);
  }

  Print("Closing");
  FileClose(handle);

  return 0;
}
 
Andrey Khatimlianskii:

As far as I remember, it sets a time-out after which the price is considered hopelessly out of date. In other words, if it hasn't changed for 3 minutes, you can't open at it.

I wrote a test script for this case. NoPrice was caught 64 seconds after the last tick. Perhaps a one minute timeout is indeed worthwhile. I'm going to have to do a little research...