Hi,
I have written an EA which I have been running in the optimiser. My EA has various inputs, one of which is a boolean whether the EA should use a trailing stop or not, and another is the value of the trailing stop.
What I would like to know is, is it possible to set up the tester, either with settings, or with changes to my code, so that the optimiser doesn't bother to test different values of the trailing stop if the trailing stop boolean is set to false.
Thanks.
If your code don't use a trailing stop when your boolean is setted to false, then the optimiser either. Actually, I don't understand why you asked.
Ok, let me clarify. There are around 10 inputs that an be changed for the EA. Let me give an example:
Test 1:
Input1: x
Input2: x
....
Input 9: (Trailing stop) True
Input 10: (Trailing stop level) 300
Test 2:
Input1: x
Input2: x
....
Input 9: (Trailing stop) False
Input 10: (Trailing stop level) 300
Test 3:
Input1: x
Input2: x
....
Input 9: (Trailing stop) False
Input 10: (Trailing stop level) 700
In the above examples inputs 1-8 are the same. Test 1 will give different results to tests 2 and 3, as test 1 uses a trailing stop. Tests 2 and 3 will give the same results, as neither uses a trailing stop, and will take up needless time in the optimisation process. I want to leave input 10 as a variable so different values of it can be tested when the optimiser runs with input 9 set to true, but when input 9 is set to false, varying input 10 will do nothing to the final balance result, but has taken up valuable time and money in the optimisation process.

- www.mql5.com
Ok, let me clarify. There are around 10 inputs that an be changed for the EA. Let me give an example:
Test 1:
Input1: x
Input2: x
....
Input 9: (Trailing stop) True
Input 10: (Trailing stop level) 300
Test 2:
Input1: x
Input2: x
....
Input 9: (Trailing stop) False
Input 10: (Trailing stop level) 300
Test 3:
Input1: x
Input2: x
....
Input 9: (Trailing stop) False
Input 10: (Trailing stop level) 700
In the above examples inputs 1-8 are the same. Test 1 will give different results to tests 2 and 3, as test 1 uses a trailing stop. Tests 2 and 3 will give the same results, as neither uses a trailing stop, and will take up needless time in the optimisation process. I want to leave input 10 as a variable so different values of it can be tested when the optimiser runs with input 9 set to true, but when input 9 is set to false, varying input 10 will do nothing to the final balance result, but has taken up valuable time and money in the optimisation process.
If you want to optimize only when Trailing Stop is true then don't use this variable in the optimization (uncheck the checkbox in front a the variable).
I would like the optimisation process to decide for me if using a trailing stop is advantageous or not, therefore I have to allow the optimiser to try both true and false states for all other variable inputs. Its just that when its set to false, there is no point in the optimiser changing the value of the trailing stop as it will have no effect. The optimiser of course has no way of knowing this. What I wanted to know is there any way of telling the optimiser this. I am suspecting not.

- www.mql5.com
I would like the optimisation process to decide for me if using a trailing stop is advantageous or not, therefore I have to allow the optimiser to try both true and false states for all other variable inputs. Its just that when its set to false, there is no point in the optimiser changing the value of the trailing stop as it will have no effect. The optimiser of course has no way of knowing this. What I wanted to know is there any way of telling the optimiser this. I am suspecting not.
Ok, I think I understood now ;-)
You can add something like that to your OnInit function :
if (Trailing_stop == false && Trailing_stop_level != 300) return(INIT_PARAMETERS_INCORRECT);

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I have written an EA which I have been running in the optimiser. My EA has various inputs, one of which is a boolean whether the EA should use a trailing stop or not, and another is the value of the trailing stop.
What I would like to know is, is it possible to set up the tester, either with settings, or with changes to my code, so that the optimiser doesn't bother to test different values of the trailing stop if the trailing stop boolean is set to false.
Thanks.