Counting parameters/outputs from custom indicator for iCustom() function

 

Hello,

I'm not a MQL4 expert but i was trying to develope the following idea.

I would want to creat an EA which could get the number of parameters and buffers(outputs) from a custom indicator, so i can use that information to implement it on the iCustom() function.

This will be use to backtest diferente custom indicators without the need to change the EA code when the custom indicator is different.

It would go something like this:

int parameters = count_parameters();

int outputs = count_outputs();

for(i=0;i<outputs;i++)

value[i] = iCustom(NULL,0,param0, param1....,output[i],0)


The first thing here is how to make  count_parameters() and count_outputs() work(if possible...). If this is not possible, I can make this two variables(parameters and outputs), as extern variables, so i can modify them on EA's Properties buttom.

And second, how to build iCustom() function with a variable number of parameters depending ont the "parameters" variable.


I don't even know if this is possible, but it is worth asking.

Thanks in advance!

Step on New Rails: Custom Indicators in MQL5
Step on New Rails: Custom Indicators in MQL5
  • www.mql5.com
Finally we've got an opportunity to try the new trade terminal - MetaTrader 5 . No doubt, it is noteworthy and has many new features as compared to its predecessor. The important advantages of this platform among others are: Essentially modified language allowing now to use the object-oriented programming, still allowing to use the rich...