- Help Needed: MT5 EA Unable to Access Existing File
- Unable to Access Files in MQL5/Files Folder - Error Code 5002
- Demo version of EA provided mql5.com market not able to write files.
I can only answer questions from an AI in the same way:
✅ Main issue:
FileFindFirst("*.flag", ..., FILE_COMMON) does not detect .flag files created by Python, even though they exist.
🧠 Likely causes:
-
Uncommon extensions like .flag are sometimes not properly detected by MT5.
-
The file is created externally (via os.replace() ), and MT5 doesn’t refresh the shared filesystem view reliably.
-
The FILE_COMMON folder is more sensitive to these timing issues or refresh delays.
✅ Recommended solutions:
-
Use a more standard extension like .json , .txt , or .trigger.json .
-
Make sure the file has at least 1 byte of content (not empty).
-
In Python, add a small delay (e.g., sleep(0.1) ) after os.replace() to let the OS fully register the file.
-
Use FileIsExist(full_path) in MT5 as an extra check.
-
As a fallback, try opening the file directly with FileOpen() to see if MT5 can read it.
Behave like a human, and you'll get a human response. 😉
C:\Users\user\AppData\Roaming\MetaQuotes\Terminal\Common\Files\signals\
Any experience or workaround from the MT5 scripting community or other developers would be greatly appreciated.
#include <fxsaber\ThirdPartyTicks\File.mqh> // https://www.mql5.com/ru/code/20225 void OnStart() { string FileNames[]; if (FILE::GetFileNames(FileNames, "*.flag", FILE_COMMON)) ArrayPrint(FileNames); }
Result.
"signals\HelloWorld.flag"
common_flag
[in] Flag determining the location of the file. If common_flag = FILE_COMMON, then the file is located in a shared folder for all client terminals \Terminal\Common\Files. Otherwise, the file is located in a local folder.
FileFindFirst - File Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use