iCustom - Load parameters from input dynamically (including bool parameters)

 

I would like to make an universal indicator tester that follows some concrete rules and I'm looking for best way to input parameters.

I couldn't find any good example on the internet. Every example assumed, that we already know all the parameters that indicator has.

I made 8 double inputs that we can put into any value we want and they are loaded one by one. We can fill only inputs that we are interested, and if we leave rest of inputs as NULL, there is no problem.

input string C1Name;        
input double C1P1 = NULL;   
input double C1P2 = NULL;      
input double C1P3 = NULL;     
input double C1P4 = NULL;      
input double C1P5 = NULL;    
input double C1P6 = NULL;      
input double C1P7 = NULL;      
input double C1P8 = NULL;     
input int C1LongBuffer;         
input int C1ShortBuffer;        
input int C1LineValue = 0; //It is used only when indicator is line-cross type (we have only one buffer and it's below or above particular value, this value is usually 0)

.
.
.

double longValue = iCustom(NULL, 0, C1Name, C1P1, C1P2, C1P3, C1P4, C1P5, C1P6, C1P7, C1P8, C1LongIndex, 1);
double shortValue = iCustom(NULL, 0, C1Name, C1P1, C1P2, C1P3, C1P4, C1P5, C1P6, C1P7, C1P8, C1ShortIndex, 1);

I know it's not an optimal solution. If you have any, I will be grateful.

It usually works... Usually, because when there is a boolean parameter it just doesn't work, it's always false. No matter if i input "1" value or I put "true" manually in the code, it doesn't want to listen.

Indicator example with bool parameter in the example.

Files:
 
  1. double longValue = iCustom(NULL, 0, C1Name, C1P1, C1P2, C1P3, C1P4, C1P5, C1P6, C1P7, C1P8, C1LongIndex, 1);
    This works if, and only if, your indicator has eight (8) or more inputs and the first eight must be double. Fails for all other indicators. Can't do it on MT4. Possible on MT5.

  2. Don't use NULL.
    1. You can use NULL in place of _Symbol only in those calls that the documentation specially says you can. iHigh does, iCustom does, MarketInfo does not. OrderSend does not.
    2. Don't use NULL (except for pointers where you explicitly check for it.) Use _Symbol and _Period, that is minimalist as possible and more efficient.
    3. Zero is the same as PERIOD_CURRENT which means _Period. Don't hard code numbers.
    4. MT4: No need for a function call with iHigh(NULL,0,s) just use the predefined arrays, i.e. High[].
 
Once I saw a tester where user could pass an indicator name and all it's parameters in one input, everything separated by coma. I think that would be an optimal solution but I don't know how to do it (I know how to split, but I don't know how to recognize input types and count of paramteres).

I will be really grateful if someone would tell me how to do input paramteres like these.
 
Kacper Górzyński: Once I saw a tester where user could pass an indicator name and all it's parameters in one input, everything separated by coma. 

You saw a non-working attempt or the indicator(s) have known parameter type(s) and thus count.

 
Kacper Górzyński:
Once I saw a tester where user could pass an indicator name and all it's parameters in one input, everything separated by coma. I think that would be an optimal solution but I don't know how to do it (I know how to split, but I don't know how to recognize input types and count of paramteres).

I will be really grateful if someone would tell me how to do input paramteres like these.

I've seen the same EA, I think the developer has used a template, I'm trying to implement it on my EA.

Reason: