Errors, bugs, questions - page 2237

 
fxsaber:

Some characters have a timeout, some do not. How do I know the maximum age of the tick that can still be perceived by OrderSend (no [No price])?

Fuck knows.

 
Stanislav Korotky:
The FILE_SHARE_WRITE flag seems to work in this combination, but another question arises: what is the point of this particular write? Logically, if we enable write separation, it should be added to the write flag:

That's exactly what I tried, and it gives an error too.

Turned on MetaTrader, found my old example, added FILE_SHARE_WRITE (although it's not needed there) - the result didn't change... Maybe for another reason it didn't work for me
 

Forum on trading, automated trading systems and testing trading strategies

MetaTrader 5 trading platform made available to AMP Futures clients

fxsaber, 2018.07.23 22:34

Example where it is impossible to make a Market Order even when Bid/Ask is a multiple of TickSize

Here Last price is not a multiple of TickSize. It has nothing to do with Market Orders, but OrderCheck still bugs - doesn't allow a Market Order to be made.

 
fxsaber:

Some characters have a timeout and some do not. How do I know the maximum age of the tick that can still be accepted by OrderSend (no [No price])?

It happens that the last tick received 16 seconds ago is not perceived as relevant to OrderSend. This must be a bug after all.

 
A100:
I enabled MetaTrader, found my old example, added FILE_SHARE_WRITE (although I didn't need it there) - the result didn't change... Maybe for another reason it didn't work for me

Alternatively, you can position the file in memory (MemMap) and work there via semaphore, and then dump the data into the file via semaphore

By the way, this method will give you a big speed gain

 
Konstantin:

Alternatively, you can position the file in memory (MemMap) and work there via semaphore, and then dump the data into the file via semaphore

By the way, this method will give you a big speed advantage

The matter is that I have a small configuration file and every EA has to read it once before starting to work - the simplest operation - see example on the links above... and you say semaphores)
 
A100:
The thing is, I had a small configuration file and each Expert Advisor only had to read it once before starting - the simplest operation - see the example in the links above... and you say semaphores)

I say that the writing on this problem for several pages, and given that the problem with the beard and fix it developers apparently can not or do not want to because I offered you one of them, if you don't like it use winapi what's the problem )) but it's better than writing the same thing without doing anything, you can use the same semaphores to read from a physical file, the same semaphore signal that is busy and need to wait!

 
Stanislav Korotky:

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;
}

The opener for reading lacks the FILE_SHARE_WRITE (allow write) flag, as there is a writer.

This is a system limitation (WinAPI).

Here are the correct flags with which your code will work:

int handle = FileOpen("xyz.foo", FILE_READ|FILE_BIN|FILE_SHARE_READ|(writing?FILE_WRITE:FILE_SHARE_WRITE));
 
Ilyas:

Here are the correct flags to make your code work:

Please fix FileLoad

Forum on trading, automated trading systems & strategy testing

Bugs, bugs, questions

fxsaber, 2018.07.10 19:26

Error in FileLoad. If with the FILE_COMMON flag, two local Agents try to read data via FileLoad, one of the Agents screws up.

It is possible to set appropriate flags in FileOpen, but not in FileLoad. Therefore, please allow access to the file via FileLoad if the other FileLoad reads it.

 
TheXpert:

why? )

Because there is no zero in the list of flags

Identifier

Value

Description

FILE_READ

1

File is opened for reading. This flag is used when opening a file (FileOpen()). FILE_WRITE and/or FILE_READ must be set when the file is opened.

FILE_WRITE

2

File is opened for writing. This flag is used to open a file (FileOpen()). When a file is opened, the FILE_WRITE and/or FILE_READ flags must be set.

FILE_BIN

4

Binary read-write mode (no conversion from or to string). This flag is used to open files (FileOpen())

FILE_CSV

8

A csv file (all items written are converted to a string of the appropriate type, unicode or ansi, and separated by a delimiter). This flag is used when opening a file (FileOpen())

FILE_TXT

16

Simple text file (same as csv, but without separator). This flag is used when files are opened (FileOpen())

FILE_ANSI

32

ANSI strings (single-byte characters). This flag is used when opening files (FileOpen())

FILE_UNICODE

64

UNICODE strings (two-byte characters). This flag is used when opening files (FileOpen())

FILE_SHARE_READ

128

Shared read access by multiple programs. This flag is used when opening a file (FileOpen()), but does not substitute the need for FILE_WRITE and/or FILE_READ when opening a file.

FILE_SHARE_WRITE

256

This flag is used for write access sharing by multiple programs. This flag is used to open files (FileOpen()), but does not substitute FILE_WRITE and/or FILE_READ when opening a file.

FILE_REWRITE

512

File can be overwritten by FileCopy() and FileMove(). The file must exist or be writable. Otherwise, file will not be opened

FILE_COMMON

4096

Location of file in shared folder of all client terminals\Terminal\Common\Files. This flag is used when opening files (FileOpen()), copying files (FileCopy(), FileMove()) and checking if files exist (FileIsExist())


And if the developers fix all their faults, many people won't like it. Much more than half of the code will stop working.

Документация по MQL5: Константы, перечисления и структуры / Константы ввода/вывода / Флаги открытия файлов
Документация по MQL5: Константы, перечисления и структуры / Константы ввода/вывода / Флаги открытия файлов
  • www.mql5.com
Файл открывается для чтения. Флаг используется при открытии файлов (FileOpen()). При открытии файла обязательно должен быть указан флаг FILE_WRITE и/или флаг FILE_READ Файл открывается для записи. Флаг используется при открытии файлов (FileOpen()). При открытии файла обязательно должен быть указан флаг FILE_WRITE и/или флаг FILE_READ Файл...
Reason: