Help me debug ... cannot load indicator 'Relative Strength Index' [4002] - page 2

 
i would appreciate help from anyone but Mr. moderator! who is too busy labeling and judging amateurs.
 
maryam mehraban #:
i would appreciate help from anyone but Mr. moderator! who is too busy labeling and judging amateurs.

There is no labelling or judgement.

Check your indicators calls and the parameters value.

 
maryam mehraban #: hi, can you help me with error 4002 please?? none of my indicators (MA & RSI) can be loaded and i keep getting 4002 in strategy tester. and here is my code:
  1. The first thing you should do is fix all the warning messages during the compile.
    Warnings may seem unimportant, but they can be the source of runtime errors.
    So, always pay attention and fix your compile warnings and errors so you get a clean compilation.
    implicit conversion from 'number' to 'string'   TestEA.mq5      144     56
    implicit conversion from 'number' to 'string'   TestEA.mq5      150     57
    implicit conversion from 'number' to 'string'   TestEA.mq5      163     46
    implicit conversion from 'number' to 'string'   TestEA.mq5      172     48
    possible loss of data due to type conversion from 'uint' to 'int'       TestEA.mq5      187     17
    implicit conversion from 'number' to 'string'   TestEA.mq5      198     63
    possible loss of data due to type conversion from 'uint' to 'int'       TestEA.mq5      206     17
    implicit conversion from 'number' to 'string'   TestEA.mq5      214     65

  2. If you are going to use different symbols or timeframes compared to the current one, make sure you synchronise the data
    Documentation on MQL5: Timeseries and Indicators Access / Organizing Data Access

  3. You should always look up the meaning of error codes in the documentation, and in this case error 4002 means "Wrong parameter in the inner call of the client terminal function".
    So, it has nothing to do with it being an external or internal indicator, but about the parameters that you are using.

  4. Now for your main question ... you have not defined an initial value for the "rsi_p" parameter nor are you testing it for valid values that will be acceptable for calling RSI.
    So obviously, if its value is invalid (example being set to 0), then it will throw a parameter error for it.
    input int rsi_p;
    The same goes for the other indicator calls if you use invalid values.
    So, check the validity of those parameter values before calling the indicator functions.
 

Thank u so much. I defined initial value for rsi_p as you said, so everything seemed fine after debugging and both MA & RSI are loaded correctly. however, i still have problem backtesting. 

strategy tester still shows 4002 error for MA (attached file), I checked the initial values for MA and nothing seems wrong :(


Fernando Carreiro #:
  1. The first thing you should do is fix all the warning messages during the compile.
    Warnings may seem unimportant, but they can be the source of runtime errors.
    So, always pay attention and fix your compile warnings and errors so you get a clean compilation.

  2. If you are going to use different symbols or timeframes compared to the current one, make sure you synchronise the data
    Documentation on MQL5: Timeseries and Indicators Access / Organizing Data Access

  3. You should always look up the meaning of error codes in the documentation, and in this case error 4002 means "Wrong parameter in the inner call of the client terminal function".
    So, it has nothing to do with it being an external or internal indicator, but about the parameters that you are using.

  4. Now for your main question ... you have not defined an initial value for the "rsi_p" parameter nor are you testing it for valid values that will be acceptable for calling RSI.
    So obviously, if its value is invalid (example being set to 0), then it will throw a parameter error for it.
    The same goes for the other indicator calls if you use invalid values.
    So, check the validity of those parameter values before calling the indicator functions.
Files:
backtest.png  73 kb
 
@maryam mehraban #: Thank u so much. I defined initial value for rsi_p as you said, so everything seemed fine after debugging and both MA & RSI are loaded correctly. however, i still have problem backtesting. Strategy tester still shows 4002 error for MA (attached file), I checked the initial values for MA and nothing seems wrong :(

We cannot take your "word" that the initial values are correct. You should "show" that they are correct.

Show your new code where you have fixed all the problems, including the verification of the inputs as being valid.

Also, show the actual parameter values being used and reported in the Strategy Tester Journal log.