I could read it form the tester log. it register it like this:
But unfortunately it's outside de "file sandbox".
There's a solution that utilizes a symlink to that log folder. Basically you need to create a sticky folder in the file sandbox that holds the symlink - sticky in the way that it cannot be removed/cleaned up by the tester. Then during OnInit you make a local copy of that log to read out its testing end date. The setup is somewhat complicated but it works:
In Tester\Agent-127.0.0.1-3000\MQL5\Files\ create a folder 'stay' (without the ' ' quotes)
In this folder create a symlink by opening a cmd shell, cd into 'stay' and run: mklink /D testerlog ..\..\..\..\logs
The symlink testerlog should now point to the \Tester\logs folder, you can check this by stepping into it.
Remove rights to delete the 'stay' folder and its contents (steps see below *)
Repeat this for all local agent directories. So if you got a quadcore this would be Agent-127.0.0.1-3001 Agent-127.0.0.1-3002 Agent-127.0.0.1-3003
Add the code snippet below to your EA:
datetime TestingEndDate;
intOnInit()
{
if(MQLInfoInteger(MQL_TESTER))
{
if(!TesterGetEndDate()) returnINIT_FAILED;
Print("Testing from ",TimeCurrent()," to ",TestingEndDate);
}
...
}
bool TesterGetEndDate()
{
TestingEndDate=0;
string filename;
string filter="stay/testerlog/*.log";
long hnd=FileFindFirst(filter,filename);
if(hnd==INVALID_HANDLE) { Print("no files found, filter: ",filter); returnfalse; }
FileFindClose(hnd);
if(!FileCopy("stay/testerlog/"+filename,0,filename,FILE_REWRITE)) { Print("copy "+filename+" failed"); returnfalse; }
int fh=FileOpen(filename,FILE_READ|FILE_TXT);
if(fh==INVALID_HANDLE) { Print("failed to open "+filename); returnfalse; }
while(!FileIsEnding(fh))
{
string s=FileReadString(fh);
if(StringFind(s,"testing of ")>0)
{
int pos=StringFind(s," to ");
TestingEndDate=StringToTime(StringSubstr(s,pos+4));
}
}
FileClose(fh);
return TestingEndDate>TimeCurrent();
}
And there you go.
* Steps to remove deletion rights from 'stay' folder:
Open properties tab of folder, flip to Security, open Advanced
Push 'Change access rights' button to get the Advanced Security settings for 'stay'
Uncheck 'Inherit rights from parent object'. You will be prompted whether to remove or set all rights, choose remove all.
Push the Add... button to select users or groups. There you push the Advanced... button to open a search dialog.
Push the Search Now button to get a list of users. Scroll to find your username and select it. Confirm with OK.
Back in the Advanced Security settings dialog, select your user and push Modify... to open a dialog with access rights.
Check Full Access once just to flip all checks on, then remove these 3 rights by unchecking the checkbox: Full Access, Deletion, Deletion of subfolders and files
Close all dialogs with OK. The folder should now show a small lock on it.
That's all. You will be able to add but not delete files. If you need to delete anything in it, go to the security settings again and grant aforementioned rights by checking their checkboxes.
Yes, I checked all the solution and there is no solution to get this information inside of (OnInitStart).
As the last message had more than 4 years, I thought someone else could give a different solution.
I'm sure Henrique Vilela (@Henrique Vilela) had a better solution, but unforntunately he disappeared without share with us.
You didn't read properly I think. Using a WinAPI call for example will allow you to do it (there is already a library to do that somewhere in the Codebase).
Most people here are only interested to grab information and never share anything, not a surprise.
You didn't read properly I think. Using a WinAPI call for example will allow you to do it (there is already a library to do that somewhere in the Codebase).
Most people here are only interested to grab information and never share anything, not a surprise.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I could read it form the tester log. it register it like this:
But unfortunately it's outside de "file sandbox".
There's a solution that utilizes a symlink to that log folder. Basically you need to create a sticky folder in the file sandbox that holds the symlink - sticky in the way that it cannot be removed/cleaned up by the tester. Then during OnInit you make a local copy of that log to read out its testing end date. The setup is somewhat complicated but it works:
And there you go.
* Steps to remove deletion rights from 'stay' folder:
Did you find a way to get the "End Date" of the test?
Does anyone knows how to do that?
Did you find a way to get the "End Date" of the test?
Does anyone knows how to do that?
Several solutions are proposed in the topic. Did you read and try them ?
There is no easy, standard mql way for sure.
Several solutions are proposed in the topic. Did you read and try them ?
There is no easy, standard mql way for sure.
Hi Alain,
Yes, I checked all the solution and there is no solution to get this information inside of (OnInitStart).
As the last message had more than 4 years, I thought someone else could give a different solution.
I'm sure Henrique Vilela (@Henrique Vilela) had a better solution, but unforntunately he disappeared without share with us.
Hi Alain,
Yes, I checked all the solution and there is no solution to get this information inside of (OnInitStart).
As the last message had more than 4 years, I thought someone else could give a different solution.
I'm sure Henrique Vilela (@Henrique Vilela) had a better solution, but unforntunately he disappeared without share with us.
You didn't read properly I think. Using a WinAPI call for example will allow you to do it (there is already a library to do that somewhere in the Codebase).
Most people here are only interested to grab information and never share anything, not a surprise.
You didn't read properly I think. Using a WinAPI call for example will allow you to do it (there is already a library to do that somewhere in the Codebase).
Most people here are only interested to grab information and never share anything, not a surprise.
Ok Alain. I will search again in the Codebase.
Thank you for your response.