Errors, bugs, questions - page 814

 
paladin800:

In external EA parameters I use parameter R only = 1 or 2 or 12 or 13 (general simple example). You can check this parameter in OnInit() and report an error if a citizen enters a different number by mistake. However, there are ENUM_... types for input. (eg. ENUM_MA_METHOD), when you can simply select a value from the expanded window.

Question. Is there an option where I can make such a construct, so that in external parameters by analogy with the ENUM_... appear only what the programmer intended, without the need to check OnInit(). I haven't found it in the documentation. If not, the wish is to do such a thing.

So do ENUM.

enum MyLimitedType
  {  
   Адын = 1,
   Дыва = 2,
   Трынацать = 13,
   Читырныцыть = 14,
  };
I even made a dirty trick using ENUM double arrays with limited steps (example here), but here I can't do without conversion into OnInit(), of course.
 
MetaDriver:

So do ENUM.

I even made up my mind to use ENUM to create double arrays with limited steps (example here), but you can't do without conversion to OnInit(), of course.
Something like this! Thanks for the link, I'll figure it out on my own.
 
paladin800:
Like this! Thanks for the link, I'll figure it out myself.

This also works for input:

enum MyLimitedType
  {  
   Адын = 1,// почти Адын 
   Дыва = 2,// совсем Дыва
   Трынацать = 13,// ++ Трынацать
   Читырныцыть = 14,// Читырныцыть.--
  };

Type in the code and call up the window, see what the enum options look like.

The code will use enum variants and the input window will use comments.

 

I have an enum like this:

enum ENUM_FIBO_LEVEL
  {
   O_0,  //0.0
   O_236,//0.236
   O_382,//0.382
   O_5,  //0.5
   O_618 //0.618
  };

ZY if the enumerator options are not assigned values like MetaDriver then the defaults will be assigned consecutive values from 0.

Документация по MQL5: Основы языка / Операции и выражения / Операции присваивания
Документация по MQL5: Основы языка / Операции и выражения / Операции присваивания
  • www.mql5.com
Основы языка / Операции и выражения / Операции присваивания - Документация по MQL5
 
Urain:

This also works for input:

Type in the code and call up the window, see what the enum options look like.

The code will use enum variants and the input window will use comments.

Yep, confirm, it all works. :)

paladin800:
Something like this! Thanks for the link, I'll look it up myself.
Good luck. Large enum's (if needed) I try to generate them automatically, because firstly I'm lazy, and secondly there are less errors/typos. In particular, those enum's, which were generated by these scripts (see trailer).
Files:
 
How to know in OnTesterPass which parameters were used for optimization? I only see that these parameters are returned at the beginning of the array parameters of the FrameInputs function, but at what point do the optimized parameters end and the constant parameters begin?
 
marketeer:
How to know in OnTesterPass which parameters were used for optimization? I only see that these parameters are returned at the beginning of the array parameters of the FrameInputs function, but at what point do the optimized parameters end and the constant parameters begin?
I do not quite understand the question, but I can suggest a useful function - ParameterGetRange
 
Rosh:
I don't quite understand the question, but I can suggest a useful function - ParameterGetRange
Yes, that's fine. Not yet available in the local help.
 
As I found out, the same truncated optimization results are passed to OnTesterPass as to the optimization results tab. I was hoping that at least in this way it would be possible to get the full set of data. So application #459431 lying in the SD is the only way out, if it ever gets done (and if it does, it will probably be after the Championship, alas).
 

Can you tell me why an error occurs when getting an indicator handle, if the name of the indicator to be called is contained in a variable?

I mean, there is no error like this:

handle=iCustom(_Symbol,tf_ind,"Name_Indicator",param_ind);

This is how we get error 4802 (Indicator cannot be created):

string lnm_ind="Name_Indicator";
//---
handle=iCustom(_Symbol,tf_ind,lnm_ind,param_ind);