I am working on an indicator A that is supposed to operate on the values computed by another indicator B. I have implemented B with 6 buffers 5 of which are plotted. B works great when I attach it to any chart. It takes 8 parameters. The first 3 parameters are as for a moving average and then it takes 5 colors for plotting the 5 buffers accordingly.
In order to let A access the values it needs to load B as a custom indicator callling the function iCustom() in A's OnInit(). I thought everything is allright but when loading A to my chart I receive runtime error 4002 which the docs describe by Wrong parameter in the inner call of the client terminal function. The call to iCustom() is
but whereever I search I always end up confirming that I am passing a parameter of the expected type. I am following many Exempels by using the values NULL and 0 for symbol and period. Of course, B.ex5 is present in my indicator directory. Could anybody tell me how to figure out which Parameter MT5 complains about?
Thanks in advance!
Check your parameters type and position.
Show the B parameters and the relevant A code (parameters declaration and error checking) if you need help.
Like I said the parameter types match. B has these parameters:
input string _1 = "B parameters";
input int InpPeriod=20; // Period
input int InpShift=0; // Shift
input ENUM_MA_METHOD InpMethod=MODE_SMA; // Method
input string _2 = "Color settings";
input color InpColor1 = clrYellow;
input color InpColor2 = clrRed;
input color InpColor3 = clrGreen;
input color InpColor4 = clrOrange;
in its OnInit() handler after setting the desired values of the variables
which are declared on the global scope of A (as is int handle).
Now it seems to me the error could only be due to the "complex" data type ENUM_MA_METHOD. I will try changing it to int tomorrow but this seems inconvenient to me. Enumerations were introduced to ensure that only valid values can be passed and I would like to use this feature.
No your parameters don't match. Why are you thinking you can remove the string parameters ?
Because they are not actual parameters but only categorising the actual parameters. Of course, MT5 does not know of this difference.
I'm not even sure if I should be angry at myself for not having thought of the simple answer. I am rather happy that I received your help letting me make progress. Thank you so much!