Coding Help

 

Hello all, I was having some trouble with an idea I had recently and I would love to get some help if possible. I'm pretty new in coding in general so if I'm missing something obvious I apologize. 

So below is my code and my idea was to be able to set the inputs of an indicator without them having to be specified in advance. The main problem is that my code as is works only for indicators that have 4 inputs only because of the only 4 possible inputs declared. 
More or less inputs make it crash. Any idea if it is possible to make it that way that it adjusts on every number of inputs needed each time?(My only thought was to make if else statements according to the NumberOfParameters input)

extern string IndicatorName="";

extern string parameters="1,2,3,4";



void OnStart()

  {

//---

int handle;

string ParametersArray[];

int NumberOfParameters = StringSplit(parameters, ',', ParametersArray);



double int1=StringToDouble(ParametersArray[0]);

double int2=StringToDouble(ParametersArray[1]);

double int3=StringToDouble(ParametersArray[2]);

double int4=StringToDouble(ParametersArray[3]);



   handle=iCustom(NULL,NULL,IndicatorName,int1,int2,int3,int4);

   ChartIndicatorAdd(NULL,0,handle);

  }
 
panosz: indicators that have 4 inputs only because of the only 4 possible inputs declared.
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
              Messages Editor

  2. There are no variadic functions.

    See the following:
              Define Variadic Arguments in Functions? - Bollinger Bands, BB - Expert Advisors and Automated Trading - MQL5 programming forum 2018.04.19
              Function with variable number of parameters - MQL4 programming forum 2018.01.06
              Different Indicators Parameters to iCustom - MQL5 programming forum 2020.04.27