Completely can't get autoconfiguration at startup to work

 

There is an idea in the metratrader 4 help files, tools > configuration at startup, that I really want to start using: I want to script my metatrader 4 to run certain commands automatically, such as:

-automatically perform and save a backtest of a specific EA and currency pair from x date to y date, using a particular setfile, etc.

-automatically open a particular chart and trade a specific EA on it using a specifc setfile (ideally these setfiles can be anywhere on the system - please let me know if they have to be in a specific location) 

However in testing from the command line, I have had no luck with the /config flag. I have previously setup dummy files exactly as described in the help files and tried to run the autostartup. I have tried each variation I have been able to google. No luck at all so far. Metatrader 4 starts up and the interface purely reflects the usual startup pattern, no reflection at all of the specified config file. I've tried to change around the config file values but there has not been any change in the program's startup pattern that I noticed.

There would be two uses: one is to batch-backtest and the other would be to automatically change my trades each day based on an analysis macro I have.

Does anybody have any success with the current build of MT4, windows 10 for my batch backtesting, and windows server 2008/2012 for my live EAs?

If I can get my head around this it would really save me many hours a week(/day when full live trading)! - I would be really grateful :D

-Kind regards,

Vikram 

 

Birt  solved this for me after I submitted a support request for Tick Data Suite v2. He gave me  the following as a .ini file ( along with the associated .set file). It doesn't have to be a .ini, I now use .txt for convenience and generate these configs from an excel macro and run them from a .bat.

 ;file start

; common settings

Login=12345

Password=12345

Server=default


; experts settings

ExpertsEnable=true

ExpertsDllImport=true

ExpertsExpImport=true

ExpertsTrades=true


; start strategy tester

TestExpert=Moving Average

TestExpertParameters=MovingAverage1.set

TestSymbol=EURUSD

TestPeriod=H1

TestModel=0

TestOptimization=true

TestDateEnable=true

TestFromDate=2014.01.01

TestToDate=2015.01.01

TestReport=MovingAverageReport

TestReplaceReport=true

TestShutdownTerminal=true 

;file end 

 

If you don't want an optimization set TestOptimization=false, and with TestReport, TestExpert and TestExpertParameters, the home folder (with no \folders\) is the terminal's home data folder, home\mql4\experts(e.g. add "Market\" for mql5 purchases), and home\Tester respectively

TestModel can be adjusted from 0(tick) upwards and date is intuitive.

The TestShutdownTerminal=True is necessary to run different config files in sequence in a .bat file (make a .txt file and then rename the extension or append to it ".bat")

 

Example .bat file:

 

@echo off

"C:\Program Files (x86)\MetaTrader - My-Broker-1\terminal.exe" "config/batch run configs/batchtestsequence1.txt"

"C:\Program Files (x86)\MetaTrader - My-Broker-1\terminal.exe" "config/batch run configs/batchtestsequence2.txt"


exit

 

These will run in sequence and if you interrupt the backtest task given to each instance in the sequence, TestShutDownTerminal will not work, and if you further do not close the terminal yourself, the sequence will not proceed (with, as far as I can tell, minimal overhead). 

Thanks so much Birt! - And to everyone else who helped fill in the blanks for me.

Cheers,

Vikram 

 

Hi vikram please share your batchtestseuence1.txt and batchtestseuence2.txt

 

Ok, I had a similar issue where mt4 completely ignored the custom settings file.

Turns out I had placed my .ini file in the <mt4 install folder>\config folder but when you start mt4 with the /config/myfile.ini setting it looks for it in its data folder's  config folder (in the appdata folder).

Hope that helps someone in the future...

Reason: