Download MetaTrader 5

ParameterSetRange

To add comments, please log in or register
Paul Anscombe
4288
Paul Anscombe  

I am having trouble using ParameterSetRange,

 basically I want the EA to automatically set the optimisation ranges for some parameters so I have done

 1. set the input parameters in the EA as normal 

2. created a OnTesterInit  function (see attached) and used the ParameterSetRange

but when I go to the optimiser the input steps defined by ParameterSetRange are not there and I have to still set it up manually.

can somebody tell em how to get this working?

 

thanks

Files:
Capture.PNG 9 kb
hatlle
68
hatlle  

I have exactly the same problem.

I asked this question four days ago, and have not received an answer yet (admittedly I did get the posting title wrong!).

This is a little used function. I wonder whether anyone has ever actually managed to get it to work correctly ...

khai hoan nguyen
242
khai hoan nguyen  

thank you for introduce install parametersetrange
Paul Anscombe
4288
Paul Anscombe  
MaxTrader:

I am having trouble using ParameterSetRange,

 basically I want the EA to automatically set the optimisation ranges for some parameters so I have done

 1. set the input parameters in the EA as normal 

2. created a OnTesterInit  function (see attached) and used the ParameterSetRange

but when I go to the optimiser the input steps defined by ParameterSetRange are not there and I have to still set it up manually.

can somebody tell em how to get this working?

 

thanks

 

 

Somebody must be able to explain how to get this to work please? 

phi nuts
2181
phi nuts  
hatlle:

I have exactly the same problem.

I asked this question four days ago, and have not received an answer yet (admittedly I did get the posting title wrong!).

This is a little used function. I wonder whether anyone has ever actually managed to get it to work correctly ...


Don't worry, I will answer you first and discuss it over there. There are no example about this, so I have to ask/read around.

Funniest answer I get so far is, "Aren't you supposed to answer and not to ask ?" 

Paul Anscombe
4288
Paul Anscombe  
MaxTrader:

I am having trouble using ParameterSetRange,

 basically I want the EA to automatically set the optimisation ranges for some parameters so I have done

 1. set the input parameters in the EA as normal 

2. created a OnTesterInit  function (see attached) and used the ParameterSetRange

but when I go to the optimiser the input steps defined by ParameterSetRange are not there and I have to still set it up manually.

can somebody tell em how to get this working?

 

thanks

 

 

has nobody out there used this function? and can explain how to get it working? what are the chances of metaquotes putting an example of how to use it in the documentation?

 

Paul Anscombe
4288
Paul Anscombe  
With much messing about I have managed to get this to work, it seems that you have to put the input variable name inside quotation marks in the ParameterSetRange function.
hatlle
68
hatlle  

Really?? That was just about the FIRST thing I tried - but it didn't work like that for me ...

(I just tried it again with quotation marks, and it still doesn't seem to work. I assume you mean double quotations like "this" rather than single quotations like 'this', becauset doesn't seem to compile with just single quotations).

Are you sure there isn't something else you have changed as well?

Could you post an example of the line of code? Are you manually ticking the box for that variable in the Inputs tab of the Strategy Tester?

Paul Anscombe
4288
Paul Anscombe  
hatlle:

Really?? That was just about the FIRST thing I tried - but it didn't work like that for me ...

(I just tried it again with quotation marks, and it still doesn't seem to work. I assume you mean double quotations like "this" rather than single quotations like 'this', becauset doesn't seem to compile with just single quotations).

Are you sure there isn't something else you have changed as well?

Could you post an example of the line of code? Are you manually ticking the box for that variable in the Inputs tab of the Strategy Tester?

here you go....

     ParameterSetRange("wo0", true, 0.0, -1.0, 0.1, 1.0);
      ParameterSetRange("wo1", true, 0.0, -1.0, 0.1, 1.0);

 this needs to be in the  OnTesterInit()  

the values "wo0" & "wo1" are inputs defined as normal in the global area of the EA

having done that I no longer need to check the boxes etc. in the optimiser.

 

 

 

hatlle
68
hatlle  

That part of your code looks exactly the same as mine. I also placed the ParameterSetRange() function inside the OnTesterInit() function ...

I still can't untick the variable box in the optimiser yet, because if I do that it gives me an error in the Journal tab saying that I need to select at least one input to optimize, so I clearly haven't got it working properly yet.

When you say that the inputs are defined as "normal", do you mean just like "double wo0;" or are you defining them as inputs like "input double wo0;" or as externs like "extern double wo0;" ? (I get what you mean by the "global area", before any functions).

Where are you placing the OnTesterInit() function in the code ? (Although I suppose this doesn't really matter, as long as it is outside any of the other functions).

This is the code I am using:

input double w_H1_1_In_1;

void OnTesterInit()
{
ParameterSetRange("w_H1_1_In_1", true, 0.0, -1.0, 0.1, 1.0);
}

// then OnInit() and the rest of the code ...

When I set the inputs to default values (by right clicking in the Inputs tab of the Strategy Tester and selecting Defaults), and leave all the variable boxes unticked for optimization in the Inputs tab then I get the following error in the Journals tab:

2013.02.12 00:01:18    Tester    no optimized parameter selected, please check input(s) to be optimized and set carefully start, step and stop values

Paul Anscombe
4288
Paul Anscombe  
hatlle:

That part of your code looks exactly the same as mine. I also placed the ParameterSetRange() function inside the OnTesterInit() function ...

I still can't untick the variable box in the optimiser yet, because if I do that it gives me an error in the Journal tab saying that I need to select at least one input to optimize, so I clearly haven't got it working properly yet.

When you say that the inputs are defined as "normal", do you mean just like "double wo0;" or are you defining them as inputs like "input double wo0;" or as externs like "extern double wo0;" ? (I get what you mean by the "global area", before any functions).

Where are you placing the OnTesterInit() function in the code ? (Although I suppose this doesn't really matter, as long as it is outside any of the other functions).

This is the code I am using:

When I set the inputs to default values (by right clicking in the Inputs tab of the Strategy Tester and selecting Defaults), and leave all the variable boxes unticked for optimization in the Inputs tab then I get the following error in the Journals tab:

2013.02.12 00:01:18    Tester    no optimized parameter selected, please check input(s) to be optimized and set carefully start, step and stop values


I suspect that you have not defined a OnTesterDeinit() without that it will not do the OnTesterInit()    

this works...... 

input double wo0 = -0.1;
input double wo1 = -0.1;
void OnTesterInit()
{
   ParameterSetRange("wo0", true, 0.0, -1.0, 0.1, 1.0);
   ParameterSetRange("wo1", true, 0.0, -1.0, 0.1, 1.0);
   return;
}

void OnTesterDeinit()
{
   return;
}

 

 

12
To add comments, please log in or register