-
Of course, it fails. Perhaps you should read the manual. File Functions
How To Ask Questions The Smart Way. 2004
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up. - You can only open files in MQLx/Files. FileOpen For security reasons, work with files is strictly controlled in the MQL4 language. Files with which file operations are conducted using MQL4 means, cannot be outside the file sandbox.
-
string fn=StringFormat("%s\\mql5\\indicators\\%s",path,__FILE__);
You are trying to open “C:\Users\«user»\AppData\Roaming\MetaQuotes\Terminal\«hex»\MQL4\files\C:\Users\«user»\AppData\Roaming\MetaQuotes\Terminal\«hex»\MQL4\indicators\«filename» ” which, of course, does not exist. -
Perhaps you should use the predefine macro __DATETIME__
-
Of course, it fails. Perhaps you should read the manual. File Functions
How To Ask Questions The Smart Way. 2004
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up. - You can only open files in MQLx/Files. FileOpen
- You are trying to open “C:\Users\«user»\AppData\Roaming\MetaQuotes\Terminal\«hex»\MQL4\files\C:\Users\«user»\AppData\Roaming\MetaQuotes\Terminal\«hex»\MQL4\indicators\«filename» ” which, of course, does not exist.
-
Perhaps you should use the predefine macro __DATETIME__
So the short answer is: No (because you can only open files in mql5/files). Thank you for this.
Can not reproduce what you mean in 3.
Full script to demonstrate that your point 3. is not coming from my code:
//+------------------------------------------------------------------+ //+------------------------------------------------------------------+ #property copyright "Copyright 2021, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { string path=TerminalInfoString(TERMINAL_PATH); string fn=StringFormat("%s\\mql5\\scripts\\%s",path,__FILE__); StringReplace(fn,".mq5",".ex5"); PrintFormat("File to open=%s",fn); ResetLastError(); int handle=FileOpen(fn,FILE_BIN); if(handle > 0) { datetime dt=(datetime) FileGetInteger(handle,FILE_CREATE_DATE); PrintFormat("created=%s",TimeToString(dt)); } else { PrintFormat("#error: script error. code=%d",GetLastError()); } } //+------------------------------------------------------------------+
So the short answer is: No (because you can only open files in mql5/files). Thank you for this.
Can not reproduce what you mean in 3.
Full script to demonstrate that your point 3. is not coming from my code:
The answer is yes. It is very possible.
The answer is yes. It is very possible.
Perhaps i need to improve my english, but the answer in 2 was:
"You can only open files in MQLx/Files. FileOpen"
I was not able to open the file at all. Can't see why changing qualifier to __DATETIME__ should solve it, because
FileGetInteger
is used after FileOpen ?
I'd like to know creating date of an indicator file. So a file outside mqlx/Files.
After my understanding Mr. Roeder said "not possible", you say, "yes, it is very possible".
If you have a working solution for this, i would appreciate a code snippet.
Many thanks.

- www.mql5.com
Perhaps i need to improve my english, but the answer in 2 was:
I was not able to open the file at all. Can't see why changing qualifier to __DATETIME__ should solve it, because
is used after FileOpen ?
I'd like to know creating date of an indicator file. So a file outside mqlx/Files.
After my understanding Mr. Roeder said "not possible", you say, "yes, it is very possible".
If you have a working solution for this, i would appreciate a code snippet.
Many thanks.
Using __DATETIME__ gives you the creating date of the indicator ex5 (the compilation date/time). Look at the documentation please.
So you don't need to use FileOpen at all, as anyway it's not possible to get information about an ex5 this way.
It's clear ;-)
string fn=StringFormat("%s\\mql5\\indicators\\%s",path,__FILE__);

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
is it possible to get creation date of a specific indicator (mql5/indicators/<file> ?
This code seems not to work:
__FILE__ is the indicator about which i need creation date info.
Thank you