Different Indicators Parameters to iCustom

 

Hello
I'm trying to make an ea where the user can type the name of the indicator in the ea settings and type list of comma separated parameters.

next i want to detect the type of every parameter and then pass it to the iCustom.

and to check if this parameter is string or double i tell the user if it string leave it as default

the default parameter is 5555

so here is the check

   if(parameter1==5555){
string par1="string1";
}
else{double par1=parameter1;}

and so on for the next parameters then at the end of the check and declaration of parameters i call the indicator

iCustom(_Symbol,_Period,indicator_name,par1,par2,par3,par4,indicator_buffer,1);

the problem is that the defined variables are only accessed in the if statement scope
tried to create a function inside it and return the value and use function overloading but didn't work as it's not allowed to create function inside a function.
so i need any way to make the local variables accessed in the ontick scope.
Please help.

 
Please note it's mql4 not mql5
 
HANY SAAD SHEHATA ABDELHALIM ABOUBAKR:
Please note it's mql4 not mql5

This belongs to MT4 section.

I think you're out of options here. In Mql 5 there's MqlParam that you could use to build an array of arguments that can be passed to IndicatorCreate (works also for custom indis.) But not in 4.

 
lippmaje:

This belongs to MT4 section.

I think you're out of options here. In Mql 5 there's MqlParam that you could use to build an array of arguments that can be passed to IndicatorCreate (works also for custom indis.) But not in 4.

don't you know any possible workaround to this?

 
Limiting to 4 datatypes (int, double, string, bool,) and n parameters, there are (4!×n!) Combinations. Therefor to fully support 2 parameters requires 48 combinations. Four (4) parameters 24×4!=576 combinations.
          Factorial - Wikipedia
 
William Roeder:
Limiting to 4 datatypes (int, double, string, bool,) and n parameters, there are (4n)! Combinations. Therefor to fully support 2 parameters requires 8!=40,000 combinations.
          Factorial - Wikipedia

well the icustom seems to make it shorter
as if we used double and the input is bool or int it will automatically detect what we want if bool it will use 0 and one instead of true and false and for int it removes the numbers after the decimal point.
so i just check if is the type is string or not if not then i use just double.

 
HANY SAAD SHEHATA ABDELHALIM ABOUBAKR: as if we used double and the input is bool or int it will automatically detect what we want if bool it will use 0 and one instead of true and false and for int it removes the numbers after the decimal point.
You are making an assumption. Try it. The Indicator will grab four bytes of the eight bytes of the double and will try to use that as an int. Garbage.
 
tried and worked but i found that i should do an statement and a call for every possible combination so as you said it's gonna be thousands.
not possible to do as i see.
 

You can make your EA aware of certain custom indis. Write a list of wrappers for each one and let the wrapper decide how to handle the input.

enum eSupportedIndicator {
   eIndiZaphodsTripleBlob,
   eVanDerWaalsForceV2,
   ...
};

input eSupportedIndicator InpCustomIndicator;
input int InpIntPar1;
input string InpStringPar1;
...

CIndiWrap *CustomIndi;

int OnInit() {
   if(InpCustomIndicator==IndiZaphodsTripleBlob){
     CustomIndi=new CIndiZaphodsTripleBlob;
   }
   ...
}

void OnTick() {
   double val=CustomIndi.getValue(...); // pass inputs here and let it pick
   ...
}
 
lippmaje:

You can make your EA aware of certain custom indis. Write a list of wrappers for each one and let the wrapper decide how to handle the input.

Already done this but it's gonna be limited for only the indicators built in and there is already an ea that do this available.

 
HANY SAAD SHEHATA ABDELHALIM ABOUBAKR:

Already done this but it's gonna be limited for only the indicators built in and there is already an ea that do this available.

So you are asking ideas here to sell them on the Market ? loool