Including Indicators via Input

 

Hi,


is it possible to write an ea where I can choose which indicator is used?

double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)


iCustom is using "string name" to select the indicator, that means that it should be possible to use simply code like:

extern string indi = "my_simbplestupid_indi";


But how about different parameters?

Is there a way to get the parameters the indicator wants to have?


I used another external string to read parameters, looks like this:

extern string inidparams = "i10,d5.5,d1.1,bfalse";

then I splited the string with a function of mine and now I know which parameters the indi has.


But now I'm stuck, how to call iCustom now to give the right parameters and get back the right double value?

The result should look like:

iCustom(Symbol(),Period(),my_simbplestupid_indi,10,5.5,1.1,false,0,0)


Is there a way to implement something like that?


Thank you

scratch

 

You could use extern int values for each indicator value. Or take each string element from the split text array and use the StrToInteger() function.


Look here:

https://docs.mql4.com/convert/StrToInteger

 

It must be possible to include any type of indicator!


So the problem is, how to call te function if the custom indi has 1 param or even more as 10 params of different types

 

Hmmm... I don't think it is possible directly. A work around could be, adjusting the indicator to accept a string for all inputs. In the indi you have to split the values, and assign to the correct param.

When calling ICustom you always pass only 1 param ( string of settings)


hth

Reason: