MQL5 error [4805] - Error applying an indicator to chart

 

Im facing a strange error if I try to run my code:

The creation of iRSI has failed: RSI_handle_38 = -1
Runtime error = 4805
tester stopped because OnInit returns non-zero code 1

The error  [4805] is described in MQL5 docs like this:

"ERR_INDICATOR_CANNOT_ADD - Error applying an indicator to chart"

Here is my code:

//HANDLERS PRO 38 - ZELENA 3
RSI_handle_38 = iRSI("CADJPY", PERIOD_H1, 24, PRICE_CLOSE);
if(RSI_handle_38 < 0){
Print("The creation of iRSI has failed: RSI_handle_38 = ", INVALID_HANDLE);
Print("Runtime error = ", GetLastError());
return(INIT_FAILED);} 

The strange thing is, that this code is generated by my C# app and I have also next 37 iRSI handlers so the code is exactly the same and they manage to load properly, but this one wont.

Example of iRSI handler 1-37:

//HANDLERS PRO 37 - ZELENA 3
RSI_handle_37 = iRSI("CADCHF", PERIOD_H1, 46, PRICE_CLOSE);
if(RSI_handle_37 < 0){
Print("The creation of iRSI has failed: RSI_handle_37 = ", INVALID_HANDLE);
Print("Runtime error = ", GetLastError());
return(INIT_FAILED);} 

Same thing happens with Bollinger Bands - it stops working sooner (around 9th handler).

Is it possible that MQL5 has some "limits" for handlers or what am I doing wrong?

Thank you for help

 

Hi, did you get some answers to this problem ??

I have a similar problem:

void AddIndicatorHandlesToArray()
{
    MqlParam mwParams[];
    ArrayResize(mwParams, 3);
    mwParams[0].type = TYPE_STRING;
    mwParams[0].string_value = "_V2TradSys\\Development\\03_Monowave";
    mwParams[1].type = TYPE_INT;
    mwParams[1].integer_value = 6;
    mwParams[2].type = TYPE_INT;
    mwParams[2].integer_value = 1;

    int arrayLength = ArraySize(_symbols);
    for (int i = 0; i < arrayLength; i++)
    {
        string symbolName = _symbols[i].symbolName;
        int mwHandle = IndicatorCreate(symbolName, PERIOD_M1, IND_CUSTOM, 3, mwParams);
        _symbols[i].mwHandle_m1 = mwHandle;
        mwHandle = IndicatorCreate(symbolName, PERIOD_M5, IND_CUSTOM, 3, mwParams);
        _symbols[i].mwHandle_m5 = mwHandle;
        mwHandle = IndicatorCreate(symbolName, PERIOD_H1, IND_CUSTOM, 3, mwParams);
        _symbols[i].mwHandle_h1 = mwHandle;
    }

    return;
}

Executed for 49 Symbols there should start 147x monowave indicator. But exactly one can't load with error "custom indicator '_V2TradSys\Development\03_Monowave' cannot load [4805]"


 
Marek Tesař:

Im facing a strange error if I try to run my code:

The error  [4805] is described in MQL5 docs like this:

"ERR_INDICATOR_CANNOT_ADD - Error applying an indicator to chart"

Here is my code:

The strange thing is, that this code is generated by my C# app and I have also next 37 iRSI handlers so the code is exactly the same and they manage to load properly, but this one wont.

Example of iRSI handler 1-37:

Same thing happens with Bollinger Bands - it stops working sooner (around 9th handler).

Is it possible that MQL5 has some "limits" for handlers or what am I doing wrong?

Thank you for help

Hello,

For such errors and the like, check this mql5.com/en/docs/constants/errorswarnings/errorcodes

 
Taiwo Okunbanjo:

Hello,

For such errors and the like, check this mql5.com/en/docs/constants/errorswarnings/errorcodes

Really not helpful at all... the @malek_mehdi already said that read this doc...

 

I had the same problem... I have an EA with multicurrency stocks and some stocks loaded the iMA indicator and others not...


Can anyone help me to understand the root cause of this problem?


This is my analysis: 

Source fragment running in OnInit():

   //This will works   
   bool petr4Selected = SymbolSelect("PETR4", true);
   ResetLastError();
   int h = iMA("PETR4", PERIOD_D1, 20, 0, MODE_EMA, PRICE_CLOSE);
   PrintFormat("iMA PETR4: %d %d", h, petr4Selected);

   //This will works too
   bool itsa4Selected = SymbolSelect("ITSA4", true);
   ResetLastError();
   int h3 = iMA("ITSA4", PERIOD_D1, 20, 0, MODE_EMA, PRICE_CLOSE);
   PrintFormat("iMA ITSA4: %d %d", h3, itsa4Selected);
   
   //This will not works
   bool tsla34Selected = SymbolSelect("TSLA34", true);
   ResetLastError();
   int h1 = iMA("TSLA34", PERIOD_D1, 20, 0, MODE_EMA, PRICE_CLOSE);
   PrintFormat("iMA TSLA34: %d %d", h1, tsla34Selected);

   //This will not works yet
   bool gold11Selected = SymbolSelect("GOLD11", true);
   ResetLastError();
   int h2 = iMA("GOLD11", PERIOD_D1, 20, 0, MODE_EMA, PRICE_CLOSE);
   PrintFormat("iMA GOLD11: %d %d", h2, gold11Selected);

Log on strategy tester:

Log directly on the chart (without tester):



The error 4805 is very useless and the doc unfortunatelly does not help at all... I known that the indicator can not be applied in the chart. The question is: why?

I think that the strategy tester has some limitations on certains symbol configurations. A bug maybe?

Follow the symbol specs:


 
There are no data for TSL34 (or GOLD11) for 2015 and 2016.
 
Alain Verleyen:
There are no data for TSL34 (or GOLD11) for 2015 and 2016.

Perfect, This is the root cause. I changed the stategy tester range and worked well. Tks a lot!

 
It can also be the parameters of the indicator without using external inputs
 

just had the same issue with a multi currency EA...just need to make sure that the symbol selected in the tester, matches the first symbol in the input string

all works fine in that arrangement

 
Alain Verleyen #:
There are no data for TSL34 (or GOLD11) for 2015 and 2016.

you saved me the day Alain! thanks!!