I want to prepare a batch file in order to do a secuence of backtest, i.e.:
start /wait terminal.exe EURUSD.txt
start /wait terminal.exe GBPUSD.txt
start /wait terminal.exe EURJPY.txt
start /wait terminal.exe EURCAD.txt
You can see http://forum.mql4.com/47016#611837 if you want to learn to do a backtest from a command line call.
The problem is this one:
"NOTE: It is a requirement that you start MT4 up via the launcher, otherwise your newly generated FXT files will be over-written or the back-test will report "n/a" indicating that it could not use your exported database. If you have manually started your terminal (eg. from the Start menu), it is still necessary to use the launcher."
So, how can I launch MT4 in command line without over-writing FXT files?
Thanks a lot
How can I launch MT4 in command line?
Re: How can I launch MT4 in command line?
I'd found this:
You can save fxt with a diferent name (i.e.: xEURUSD1_0.fxt). Then, in init function you can rewrite the fxt files generated by tester.
#import "kernel32.dll"
int CopyFileA(string strExistingFile, string strCopyOfFile, int OverwriteIfCopyAlreadyExists);
#import
int init() {
//## FXT FILE PATCH
int time=Period();
string symbol=Symbol();
string strCurrentFile = TerminalPath() + "\\tester\\history\\x"+symbol+time+"_0.fxt";
string strNewName = TerminalPath() + "\\tester\\history\\"+symbol+time+"_0.fxt";
int copy=CopyFileA(strCurrentFile, strNewName, 0);
Print("FXT file copied");
return(0);
}
I'll try it.
You can save fxt with a diferent name (i.e.: xEURUSD1_0.fxt). Then, in init function you can rewrite the fxt files generated by tester.
#import "kernel32.dll"
int CopyFileA(string strExistingFile, string strCopyOfFile, int OverwriteIfCopyAlreadyExists);
#import
int init() {
//## FXT FILE PATCH
int time=Period();
string symbol=Symbol();
string strCurrentFile = TerminalPath() + "\\tester\\history\\x"+symbol+time+"_0.fxt";
string strNewName = TerminalPath() + "\\tester\\history\\"+symbol+time+"_0.fxt";
int copy=CopyFileA(strCurrentFile, strNewName, 0);
Print("FXT file copied");
return(0);
}
I'll try it.
Re: How can I launch MT4 in command line?
Hi Jarl,
Thanks for your suggestion. At the moment Tickstory doesn't allow launching directly from the command-line. We are considering this as a future feature.
The suggestion you made regarding copying the FXT file is a good one. Obviously it only applies to those users who have access to the EA code. Perhaps you can let us know how you go with this?
Thanks!
Thanks for your suggestion. At the moment Tickstory doesn't allow launching directly from the command-line. We are considering this as a future feature.
The suggestion you made regarding copying the FXT file is a good one. Obviously it only applies to those users who have access to the EA code. Perhaps you can let us know how you go with this?
Thanks!
Re: How can I launch MT4 in command line?
I'm trying it, but it still fails.
The file is copied fine, but I get no results at 99.99%.
There is something else I should do, any clue?
The file is copied fine, but I get no results at 99.99%.
There is something else I should do, any clue?
Re: How can I launch MT4 in command line?
Hi Jarl,
Have you managed to get 99.9% back-tests by following the 'normal' process? If so, it may be that replacing the FXT file in the Init() function doesn't work.
Thanks.
Have you managed to get 99.9% back-tests by following the 'normal' process? If so, it may be that replacing the FXT file in the Init() function doesn't work.
Thanks.