string FileLocation = TerminalInfoString(TERMINAL_DATA_PATH)+"\\"; FileLocation = FileLocation +"MQL5\\"; FileLocation = FileLocation +"Profiles\\"; FileLocation = FileLocation +"Templates\\"; FileLocation = FileLocation +"RP_AUDUSD.tpl";
You can't read outside the sandbox with normal code.
For security reasons, work with files is strictly controlled in the MQL5 language. Files with which file operations are conducted using MQL5 means, cannot be outside the file sandbox.
FileOpen - File Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
File Write Problem (Error: 5002) - Expert Advisors and Automated Trading - MQL5 programming forum #1-2 (2020)
and FolderDelete using TERMINAL_DATA_PATH - General - MQL5 programming forum (2017)
Can a file that exists outside of the MetaTrader folders be opened? - MQL4 programming forum #1-#3 (2020)
File Path for saving .csv files in MT5 - MQL5 programming forum (2019)
File Operations via WinAPI - MQL4 Articles (2008)
You can't read outside the sandbox with normal code.
File Write Problem (Error: 5002) - Expert Advisors and Automated Trading - MQL5 programming forum #1-2 (2020)
and FolderDelete using TERMINAL_DATA_PATH - General - MQL5 programming forum (2017)
Can a file that exists outside of the MetaTrader folders be opened? - MQL4 programming forum #1-#3 (2020)
File Path for saving .csv files in MT5 - MQL5 programming forum (2019)
File Operations via WinAPI - MQL4 Articles (2008)
William - many thanks - I understand.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am trying to establish if a template exists for a specific currency pair before trying to open a new chart from within my MT5 EA then applying the template
My Report_StringError traps the error code and prints to a file for testing.
The above code returns an error "error: 5002 Invalid file name" does not exist.
The template does exist.
Is this something that I should be able to 'check' in MT5 or have I misunderstood?
Any help appreciated