Tester: Automated Optimization of a Trading Robot in Real Trading - page 2

 

I have been interested in this approach to optimization for sometime and although I am a fair programmer I am having difficulty getting the sample script to operate properly.


In the original MACDeSample2.1_1 the optimize routine was called within the EA and not from the #include auto_optimization.mqh

as such I am using the original where all the cals are within the EA itself.


Everything appears to work fine, it opens the secondary optimizer tester platform and runs an optimization and appears to work properly but I continue to get this error in my main terminal error log:


2009.09.18 03:39:53 MACDeSample2.1_1 EURUSD,M30: new size -1 for ArrayResize function is incorrect

2009.09.18 03:39:53 ComFracti_optimize EURUSD,M30: sh2 0 | sh3 0 | sh4 0 | sh5 0 | levelb 0 | levels 0


Have no idea and can not figure out why the error new size -1 means,


I have placed the optimization routine into another pEa and hopefully have edited the perminiters properly but get the same error repeatly.


Can someone help here please as I am at my wits end on this and really want to learm more here. If I can get this to work then I can figure out the basics better without bothering programmers that are better than myself.

Life is about learning so as we help we learn more ourselves.

Please any help is appreciated here.

 

Hi all,


I'm having trouble getting this to work. The code creates the optimise.ini file and copies it into the terminal folder successfully, but when the shell command is given to launch the terminal, I do not see any new window appear and no optimization is performed. Since the output .htm file is never produced, the script keeps trying to move the output file (prior to analyzing it) once every minute before it finally gives up. If I allow the script to run to this point and then shut down my MT4 instance before launching the same terminal command manually (/terminal.exe optimise.ini) from a new command shell window (in XP), then a new MT4 instance it opened and the optimization is performed correctly. It seems that invoking the shell command through the script is perhaps just changing the focus to the already-opened MT4 instance instead of launching a new instance and so the optimizer/tester is never invoked? This is just my guess.


Does anyone know how to remedy this issue or of any further tests I can perform to figure out what is going on? Thanks in advance for any kind assistance.


John

 
Is there a reason why this tool must use a second instance of MT4? Why not in the same MT4 on a seperate chart not in use?
 
Has anybody actually used such an approach (constantly re-optimizing, be it automated or not) in a real world scenario during some longer time period and was constantly profitable? If so: what kind of EA (what kind of strategy, maybe even a freely available EA)?
 
I need help, the files stored, FileTest2 has only zeros in it???
 
Complex information. Give me a link to a detailed description.
 

I have found AutoOptimizer - MetaTrader4 oriented forex software that makes it possible to optimize any expert advisor or several expert advisors simultaneously in fully automated mode.


You need mq4 file for this purpose.Installation and Usage.

1. Create new folder AutoOptimization on disc C (or create folder with your own name in your own place)
2. Copy MTester.exe and StartMTester.exe to folder AutoOptimization
3. Add strings to Expert Advisor code:
extern int OptimAuto=1; // 0- switch off 1- switch on auto optimization extern string OptimEveryTime="10.45"; // auto optimization start time (local PC time)
extern string OptimEveryWeek="1,2,3,4,5,6,7"; // day (1 –Monday etc.)
extern string OptimEveryMonth="10,20,30"; // day of month
extern int OptimPeriod=30; // period for optimization, day

You can find example: MACD Sample.mq4 file





4. Add Expert advisor to chart and set OptimAuto=1 and set optimization time according your needs. You must specify the time in 24 hours format. For example 1.30 pm you should set 13:30



5. Run MTester.exe file
6. AutoOptimazer should create folders automatically:

Folders:

HTML_TESTER optimization reports (with data and time)
LOG_TESTER log files for program
RUN_TESTER log files for experts
SET_TESTER *.set files for optimization

Files in these directories are placed in subdirectories under the names MetaTrader 4 terminals.




7. Open strategy tester and create and save .set file with optimization parameters to folder “SET_TESTER” sub folder “your MetaTrader name”
File name should be: expert advisor name+'_'+currency+'_'+ timeframe+'.set'


For example for MACD Sample.mq4 currency EURUSD time frame H1 file name should be:
MACD Sample_eurusd_h1.set
If the tester (later) will not find it appropriate expert SET file it will display a warning and it will display a correct name for set file.
Example:
If you would like to optimize StopLoss from 4 pips to 10 pips with step 1; TakeProfit from 20 pips to 100 pips with step 1; every 1 day of month on 10.45am. Optimization period 30 days.
You should set:
StopLoss start 4 step 1 stop 10
TakeProfit start 20 step 1 stop 100
OptimEveryTime 10.45
OptimEveryWeek 1
OptimEveryMonth 1
OptimPeriod 30
And save set file to folder “SET_TESTER” sub folder “your MetaTrader name”


More information about forex autooptimizer

 
Hi, the following string of the code sets the Model parameter to "Every tick". I would like to know how to modify it to get the "Open price only" setting. If I put 1, or 2, or 3 instead of 0 I get the "Control point" setting. Thank you for this grear article!
// Modeling mode
ArrayOpttim[6] = "TestModel=" + 0;

Pippo
 
Pheniox:

I have been interested in this approach to optimization for sometime and although I am a fair programmer I am having difficulty getting the sample script to operate properly.


In the original MACDeSample2.1_1 the optimize routine was called within the EA and not from the #include auto_optimization.mqh

as such I am using the original where all the cals are within the EA itself.


Everything appears to work fine, it opens the secondary optimizer tester platform and runs an optimization and appears to work properly but I continue to get this error in my main terminal error log:


2009.09.18 03:39:53 MACDeSample2.1_1 EURUSD,M30: new size -1 for ArrayResize function is incorrect

2009.09.18 03:39:53 ComFracti_optimize EURUSD,M30: sh2 0 | sh3 0 | sh4 0 | sh5 0 | levelb 0 | levels 0


Have no idea and can not figure out why the error new size -1 means,


I have placed the optimization routine into another pEa and hopefully have edited the perminiters properly but get the same error repeatly.


Can someone help here please as I am at my wits end on this and really want to learm more here. If I can get this to work then I can figure out the basics better without bothering programmers that are better than myself.

Life is about learning so as we help we learn more ourselves.

Please any help is appreciated here.

Hi, I'm having the same problem you desribed above. Did you find a way to work it out? I would appreciate any piece of advice. Thank you for your attention and have a great day!

Pippo

 
pippocar:
Pheniox:

I have been interested in this approach to optimization for sometime and although I am a fair programmer I am having difficulty getting the sample script to operate properly.


In the original MACDeSample2.1_1 the optimize routine was called within the EA and not from the #include auto_optimization.mqh

as such I am using the original where all the cals are within the EA itself.


Everything appears to work fine, it opens the secondary optimizer tester platform and runs an optimization and appears to work properly but I continue to get this error in my main terminal error log:


2009.09.18 03:39:53 MACDeSample2.1_1 EURUSD,M30: new size -1 for ArrayResize function is incorrect

2009.09.18 03:39:53 ComFracti_optimize EURUSD,M30: sh2 0 | sh3 0 | sh4 0 | sh5 0 | levelb 0 | levels 0


Have no idea and can not figure out why the error new size -1 means,


I have placed the optimization routine into another pEa and hopefully have edited the perminiters properly but get the same error repeatly.


Can someone help here please as I am at my wits end on this and really want to learm more here. If I can get this to work then I can figure out the basics better without bothering programmers that are better than myself.

Life is about learning so as we help we learn more ourselves.

Please any help is appreciated here.

Hi, I'm having the same problem you desribed above. Did you find a way to work it out? I would appreciate any piece of advice. Thank you for your attention and have a great day!

Pippo




you need to download the newer version auto_optimization.mqh called auto_optimization_204.mqh

https://www.mql5.com/ru/code/7090

Then edit the MACD expert advisor and update the file name that is called in the include line:

original

#include <auto_optimization.mqh>

change to

#include <auto_optimization_204.mqh>

now recompile the updated MACD example in both tester and tester-terminal

Reason: