How to get around max number parameters in iCustom ?

 

Hi


i got an indicator that has too many parameters for the iCustom function call in an EA.

i got a "'iCustom' - wrong parameters count" error in MT5

how can i get around that problem ? i'd like to be able to change the indicator parameters inside the EA rather than recompiling the indicator with different settings each time

is there a way around it ?


thanks


Jeff

 
  1. We can't see your broken code — we can only guess. Always post the relevant code and its context.
  2. The limit IIRC is 63 parameters. Simplify your indicator, or split it into multiple ones.
  3. Have the important parameters listed first so you can default the remaining ones out of the iCustom call.
 
William Roeder:
  1. We can't see your broken code — we can only guess. Always post the relevant code and its context.
  2. The limit IIRC is 63 parameters. Simplify your indicator, or split it into multiple ones.
  3. Have the important parameters listed first so you can default the remaining ones out of the iCustom call.

i think i found a way : create an input string that will contain all the parameters of one part of the indi

like :

input string s0 = "1.0;true;2;10;0.001"; and then i can input a lot of parameters into 1 string so it saves many parameters

and i can have all the nice parameters on the EA side and it will convert their values to a string that will be sent to the special indicator version...

i think it should work

but what is the limit of a string size? maybe i'll have to split the params over a few strings

Jeff

 
Jean Francois Le Bas:

i think i found a way : create an input string that will contain all the parameters of one part of the indi

like :

input string s0 = "1.0;true;2;10;0.001"; and then i can input a lot of parameters into 1 string so it saves many parameters

and i can have all the nice parameters on the EA side and it will convert their values to a string that will be sent to the special indicator version...

i think it should work

but what is the limit of a string size? maybe i'll have to split the params over a few strings

Jeff

ok i finalized the code and it works fine. And ONE string can hold my 139 parameters (with some doubles)

so it's a viable solution right there ! i just send ONE parameter (the huge string) to the indicator and the indi deals with it and updates the values of the 139 parameters accordingly.

if the string is empty, then it uses the normal "input" values.

it works perfect

Jeff

 
Jean Francois Le Bas #:

ok i finalized the code and it works fine. And ONE string can hold my 139 parameters (with some doubles)

so it's a viable solution right there ! i just send ONE parameter (the huge string) to the indicator and the indi deals with it and updates the values of the 139 parameters accordingly.

if the string is empty, then it uses the normal "input" values.

it works perfect

Jeff

Hello Jeff, 

i have the same problem and tried putting all my parameters into a string like so : 

   
 string FnParameters;
   FnParameters+= "double" + (string)CurrentPrice+ ","+ "double"+ (string)askPrice +","+ "char " + "&"+(string)alertswitchPrevious 
   + ","(string)BBConvDivergence+ ","+ "char" + (string) TotalScore+ ","+ 
   "double" + (string)FramaCurrentPrice+ ","+  "double" + (string)ATRCurrent+ ","+ 
   "double" + (string)RVILinea;
....
//Function below  
char AssessTradeOpp (string FnParameters) {....}

but it doesnt work...mind sharing how you do it?

 
Put it into a csv file and read it.
 
Carl Schreiber #:
Put it into a csv file and read it.

thanks for this idea. i have never done read write before (newbie here) but i will attempt...

 
JimSingadventure #:

thanks for this idea. i have never done read write before (newbie here) but i will attempt...

rather than using "

(string)BBConvDivergence

use

DoubleToString()

or

IntegerToString()

 
Jean Francois Le Bas #:

rather than using "

use

DoubleToString()

or

IntegerToString()

Hello Jean,

Thanks for getting back. i tried your suggestion but i'm getting a "wrong parameter count" error even when no. of parameters are the same.

btw, i'm using a simple string variable-only, not an input string variable as i do not know how to use input variables yet. 

also i'm not doing any custom indicator but only a normal function with many paramters that exceeds 63 nos.

Here's what i did : 

 string FnPara;
FnPara+= 
  DoubleToString(CurrentPrice)+ ", " 
+ DoubleToString(askPrice) + ", "
+ CharToString(alertswitchPrevious) + ", "
+  BBConvDivergence  + ", "  //this is already a string
+ CharToString(TotalScore)+ ", " 
+ DoubleToString(FramaCurrentPrice) + ", "
+ DoubleToString(ATRCurrent)+ ", " 
+ DoubleToString(RVILinea); 
     
  
 char alertswitch = Function(FnPara);  //this is the function call

//below is the actual Function
 char Function(
	double CurrentPrice, 
	double askPrice, 
	char &alertswitchPrevious, 
	string BBConvDivergence, 
	char TotalScore, 
   	double FramaCurrentPrice, 
	double ATRCurrent, 
   	double RVILinea
	)
    {....

appreciate so much if you or anyone can guide me further please? 

 
JimSingadventure #:

Hello Jean,

Thanks for getting back. i tried your suggestion but i'm getting a "wrong parameter count" error even when no. of parameters are the same.

Here's what i did : 

appreciate so much if you or anyone can guide me further please? btw, i'm using a simple string variable-only, not an input string variable as i do not know how to use input variables yet.

Look at your function: it expects 8 parameters of different types, but you call it with just one string parameter.

And if you have just these 8 parameters, why don't you simply hand them over as they are?

If you really want to do it that way for whatever reason, then you have to make the function taking just one string-parameter, and then split it up again to  the values you want to work with, e.g.

string FnPara = DoubleToString(CurrentPrice) + "," +
                ...
                DoubleToString(RVILinea);
  
char alertswitch = Function(FnPara);  //this is the function call

//below is the actual Function
char Function(string FnPAra)
{
   string parameters[];
   StringSplit(FnPAra, ',', parameters);
   double CurrentPrice = StringToDouble(parameters[0]);
   ....
   double RVILinea = StringToDouble(parameters[8]);

No offense, but i'd strongly recommend to read at least the basic chapters of the documentation, otherwise you will face the next "problem" very soon, and to find people who answer such basic progrmming-questions which have nothing to do with MQL-programming in particular in this forum are really rare.

 
Thomas S. #:

Look at your function: it expects 8 parameters of different types, but you call it with just one string parameter.

And if you have just these 8 parameters, why don't you simply hand them over as they are?

If you really want to do it that way for whatever reason, then you have to make the function taking just one string-parameter, and then split it up again to  the values you want to work with, e.g.

No offense, but i'd strongly recommend to read at least the basic chapters of the documentation, otherwise you will face the next "problem" very soon, and to find people who answer such basic progrmming-questions which have nothing to do with MQL-programming in particular in this forum are really rare.

thank you very much Thomas! appreciate your pointers.

I do and did read documentations before i post questions. The problem is that i have difficulty understanding them.  i'm not coming from a programming background but trying to learn as i go....so some things which are pretty basic to you may not be for me so hope you understand.


anyway, your pointers is a good "way out" for me. Btw, i have already exceeded the limit 63 nos. of parameters but posted only 8 here for illustration purpose and to make my post more concise.