This is only partially related to the post of the original poster. This is the solution I discovered after encountering the same 4002 error with an indicator I downloaded from the MT5 market. The first input parameter was the name of the custom indicator, a string, naturally; the second was the period of a moving average, an int; and the third was where it got interesting. It was one of those things where you had to pick the MA method from a dropdown list:
(0) Simple Moving Average
(1) Exponential Moving Average
(2) Smoothed
(3) Linear weighted MA
In the code, I had been writing out the full string, "Linear weighted MA", exactly as it appeared in the dropdown. This was the source of my error. The code didn't want a string. It wanted an int! When I entered the int that corresponded with the position of "Linear weighted MA" in the dropdown list (in this case, the number 3), BOOM! The error went away and everything worked!
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I have same problem and did checked parameters type!
My code is this! it calculates Weighed ATR and pass it through ADATR function!
I tested this code individually and it works perfectly! But when I try to use it in my main code, Error 4002 just pops up!!!
I tried all mentioned solutions and guesses mentioned in this article! but NO progress!!!
Has anyone any savior Idea?!
Mahdi,
My friend I am having the same issue.. did you ever find a solution to this issue?
Mahdi,
My friend I am having the same issue.. did you ever find a solution to this issue?
Show us your code, we don't have crystal ball :-))
This is only partially related to the post of the original poster. This is the solution I discovered after encountering the same 4002 error with an indicator I downloaded from the MT5 market. The first input parameter was the name of the custom indicator, a string, naturally; the second was the period of a moving average, an int; and the third was where it got interesting. It was one of those things where you had to pick the MA method from a dropdown list:
(0) Simple Moving Average
(1) Exponential Moving Average
(2) Smoothed
(3) Linear weighted MA
In the code, I had been writing out the full string, "Linear weighted MA", exactly as it appeared in the dropdown. This was the source of my error. The code didn't want a string. It wanted an int! When I entered the int that corresponded with the position of "Linear weighted MA" in the dropdown list (in this case, the number 3), BOOM! The error went away and everything worked!