Stuck again!!
two problems with the code below.
First is with the toolbar autotrade function switched off, when I attach this EA to the chart the EA still runs. WHY?
Second the EA gives a 5004 error and I cant see why.
What am I doing wrong please
AutoTrading allow/disallow an EA to take trade (buy, sell) but the EA still is working.
For your second question :
ERR_CANNOT_OPEN_FILE |
5004 |
File opening error |
You are probably trying to open an non-existent file. You have to read documentation ;-)
If FILE_READ is specified, an attempt is made to open an existing file. If a file does not exist, file opening fails, a new file is not created.
AutoTrading allow/disallow an EA to take trade (buy, sell) but the EA still is working.
For your second question :
ERR_CANNOT_OPEN_FILE |
5004 |
File opening error |
You are probably trying to open an non-existent file. You have to read documentation ;-)
Hi angevoyageur,
First - Sorry but on MT4 the EA does not run if autotrade has not been selected so I dont understand why this is so on MT5
Second, the EA code above works perfectly correctly on MT4 if you change
" VoidOnTick()" to "int start()"
and the three occurrences of "== INVALID_HANDLE to " < 0 "
just try the code and see the results please as you should see that the file is opened then closed but fails on the re-opening
Hi angevoyageur,
First - Sorry but on MT4 the EA does not run if autotrade has not been selected so I dont understand why this is so on MT5
Second, the EA code above works perfectly correctly on MT4 if you change
" VoidOnTick()" to "int start()"
and the three occurrences of "== INVALID_HANDLE to " < 0 "
just try the code and see the results please as you should see that the file is opened then closed but fails on the re-opening
1° I can't explain you why MT4 and MT5 are different, but they are.
2° Your first command is FileOpen for reading. I don't have this file so I have 5004 error immediatly.
Where is located your file target.dat ?
1° I can't explain you why MT4 and MT5 are different, but they are.
2° Your first command is FileOpen for reading. I don't have this file so I have 5004 error immediatly.
Where is located your file target.dat ?
1st - thanks anyway
2nd - I just spotted the problem - if you follow the code it first tries to open for reading to test if the file exists and when it finds it does not it generates it.
the code then opens the file to read it.
unfortunately on the second tick it again tests to see if the file exists which now it does --- but now it tries to open it again but its already been opened successfully so gives error 4003
Thanks for your patience

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Stuck again!!
two problems with the code below.
First is with the toolbar autotrade function switched off, when I attach this EA to the chart the EA still runs. WHY?
Second the EA gives a 5004 error and I cant see why.
What am I doing wrong please