using tester with external EXE files =) ...

 

Hi Everyone!


So I've been using the shell32.dll to execute .exe files for my EA.. It works fine, however, I can't use it in tester because as soon as the EA fires off the command, it proceeds with the rest of the script.. is there a way to make tester pause from setting off the next tick until all the processes of my EA (including the external EXE file) is finished?


Have a great weekend, and thanks in advanced!! =)


#import "shell32.dll"
int ShellExecuteA(int hwnd,string Operation,string File,string Parameters,string Directory,int ShowCmd);

#import


ShellExecuteA(0, "Open", "C:\Program Files\MetaTrader - Alpari UK\experts\files\Neuro.exe", "", "", 1);

 

Hi

I'm using a loop ( because sleep isn't possible in Tester ) with a pre-calculated timeout variable. This timeout is the result of a manual tester with the same parameters and for the same period.

Phil

 

call a batch file

Rem Call Neuro.exe
Neuro.exe
Rem After Neuro.exe is finished, create ready.txt
copy template.txt ready.txt

inside the batch file you call neuro.exe.

after that from the batch file write a file i.e. "ready.txt"

in the EA you make a loop and check if "ready.txt" exists.

loop until the file is there, than delete ready.txt and go on with your calculations.

bool FileExists(string FileName)
{
int FileHandle=FileOpen(FileName,FILE_READ);
int Result=FileHandle;
if(FileHandle>0){FileClose(FileHandle);}
return (Result);
}