Why some EA's can be Optimized on lots and SL/TP and some dont work?

 

Hi,

Im writing an EA, and I cant optimize on SL or TP like I can on some others.

Anyone know the reason for this?

Thanks for your help.

Micky

 
It is possible your code is wrong :-)
 
Micky52 wrote >>

Hi,

Im writing an EA, and I cant optimize on SL or TP like I can on some others.

Anyone know the reason for this?

Thanks for your help.

Micky

If you don't set your variables as external, the won't show up in the inputs window; ie: extern double TP = 100;

HTH

Keith

 
kminler:

If you don't set your variables as external, the won't show up in the inputs window; ie: extern double TP = 100;

HTH

Keith

Of course I did that.......

It will run all the way but with no results, and come back at the end in the journal with something like

"There were xx passes done during optimization, xx results have been discarded as insignificant"

 
Micky52 wrote >>

Of course I did that.......

It will run all the way but with no results, and come back at the end in the journal with something like

"There were xx passes done during optimization, xx results have been discarded as insignificant"

Try unchecking "Skip useless Results" in the Optimization tab, run a test, then you will see if you are just generating losing trades. Should also check the logs

for messages.

Keith

 
kminler:

Try unchecking "Skip useless Results" in the Optimization tab, run a test, then you will see if you are just generating losing trades. Should also check the logs

for messages.

Keith

Did all that Keith, right down to 1 optimization with only 2 settings.

ie: start 1, step 1, max 2.

And it still failed with the error shown above.

What im really asking for is if someone knows about some restrictions in Mql4 that would cause that, or what type of miscoding would

cause this to happen.

Thanks

Micky

 
Micky52:

Did all that Keith, right down to 1 optimization with only 2 settings.

ie: start 1, step 1, max 2.

And it still failed with the error shown above.


Then just run without optimization and look at the actual outputs in Results tab, using step 1 then step 2. If there are no results, ie. no orders, you need to put in more Print() statements so you can find out why there are no orders when you expected some. If there are orders but wrong, you still need Print() statements to track down why. Either way, you need more Print() statements. One possibility is that some things which you are expecting the code to do (like rounding) and which the code is actually doing are quite different, and the only way to find out is Print().