Source code
MQL5 CSV files: find the right folder and delimiter
An EA can compile correctly yet read no rows because its file is in the wrong place or uses the wrong delimiter. A small, invented CSV is a better first diagnostic than a large proprietary dataset.
Locate the sandbox
FileOpen works within the permitted MQL5 file locations. Normal terminal and testing contexts use different file areas; FILE_COMMON targets the shared terminal files folder. Do not assume that a desktop path or another terminal data folder is accessible.
Inspect the format
FILE_CSV defaults to a tab delimiter unless another delimiter is supplied. A file exported with commas therefore needs matching reader settings. Encoding and a header row also affect how text becomes fields.
Try three known rows
Create an illustrative file containing a header and two clearly different records. Log the open result, field count and first parsed value. Keep the sample free of account data. If all values arrive in one field, examine delimiter handling before changing the strategy.
Make failure understandable
Ask AI to distinguish file missing, empty file and malformed row in the log. Decide whether the strategy should skip the affected signal or wait for a valid file. Do not silently replace missing information with a plausible number that makes the test appear to succeed.
FileOpen and file access modes
Back to top












