Download MetaTrader 5
To add comments, please log in or register
Join MQL5 Cloud Network. Start earning money!
strontiumDog
263
strontiumDog 2014.08.12 16:53 

Hello

I have a 28 charts loaded with the same EA, and AutoTrading off.  The EA, on init, opens a file, populates an array from the contents, and close the filehandle.

If I click AutoTrade on, all the EAs jump into action at the same time.  They all try and access the file at the same time.  I know Windows does not allow different programs to open a file resource if another already is, but these are all operating under the same program (I think MT4 is 32 bit and single threaded) so how should I go about avoiding the problems which I'm getting where some of the arrays don't get the contents of the file applied.  I'm thinking of enlarging the function so that it knows which symbol it is on and delays the read by a number of seconds so that I can setup a 28 chart strategy without problems.

Alain Verleyen
Moderator
28596
Alain Verleyen 2014.08.12 18:06  
strontiumDog:

Hello

I have a 28 charts loaded with the same EA, and AutoTrading off.  The EA, on init, opens a file, populates an array from the contents, and close the filehandle.

If I click AutoTrade on, all the EAs jump into action at the same time.  They all try and access the file at the same time.  I know Windows does not allow different programs to open a file resource if another already is, but these are all operating under the same program (I think MT4 is 32 bit and single threaded) so how should I go about avoiding the problems which I'm getting where some of the arrays don't get the contents of the file applied.  I'm thinking of enlarging the function so that it knows which symbol it is on and delays the read by a number of seconds so that I can setup a 28 chart strategy without problems.


Not true, you can access a file with multiple programs if the file is open in sharing_mode.

whroeder1
13617
whroeder1 2014.08.12 18:57  
angevoyageur: Not true, you can access a file with multiple programs if the file is open in sharing_mode.
  1. Open read only/shared
  2. Use a mutex
/
To add comments, please log in or register