Indicatorecreate returns err # 4802 - ERR_INDICATOR_CANNOT_CREATE

 

Hi

 I wrote a pivot indicator which when attached to a graph plots the pivots according to a timeframe parameter.

When trying to call this indicator from a script, I get the above error #4802 - 

ERR_INDICATOR_CANNOT_CREATE.

the code that creates the handle:

   ArrayResize(params,2);  
   params[0].type          =TYPE_STRING;
   params[0].string_value  ="My Pivots Indicator";
   params[1].type          =TYPE_INT;
   params[1].integer_value = PERIOD_D1;
   DP = IndicatorCreate(Symbol(), 0,IND_CUSTOM,2,params);
   if (DP==INVALID_HANDLE) Print("invalid handle for DP",GetLastError() );

am I doing something wrong? 

 
amir_avatar posted # :

Hi

 I wrote a pivot indicator which when attached to a graph plots the pivots according to a timeframe parameter.

When trying to call this indicator from a script, I get the above error #4802 - 

ERR_INDICATOR_CANNOT_CREATE.

the code that creates the handle:

   ArrayResize(params,2);  
   params[0].type          =TYPE_STRING;
   params[0].string_value  ="My Pivots Indicator";
   params[1].type          =TYPE_INT;
   params[1].integer_value = PERIOD_D1;
   DP = IndicatorCreate(Symbol(), 0,IND_CUSTOM,2,params);
   if (DP==INVALID_HANDLE) Print("invalid handle for DP",GetLastError() );

am I doing something wrong? 

Can you provide a source code of your indicator?

You can send it via private messages.

 

I got the reason, the ex5 of the custom indicator must reside in terminal path (and not common path).

I still don't get how to work correctly with paths (which element should be in which path).

 

Thanks. 

 
I suspect there is not custom indicator 'My Pivots Indicator.mq5' in terminal_folder/MQL5/Indictor.
 

Rosh,

I've installed MT5 on d:\program files\metatrader 5.

So my path variables are:

terminal_data_path= C:\Users\A J\AppData\Roaming\MetaQuotes\Terminal\E6E3D0917DD641581E4779524EB3B1AA
common_data_path= C:\ProgramData\MetaQuotes\Terminal\Common
terminal_path= D:\Program files\metatrader 5

My ex5 indicator is in terminal_path and still, the getlasterror() returns 4802.

But if I place the ex5 on the terminal_data_path - it works. according to docs it should be vice versa (in terminal_path).

Is it a bug or I misunderstood the docs?

One more thing, the custom indicator can't work in a subfolder of the terminal_path?   

Thanks. 

 

Your OS is Vista. Run your terminal with parameter /portable.


 

It's windows 7. Parameter is not valid.

 
amir_avatar posted # :

It's windows 7. Parameter is not valid.

Have you tried to run by this way?

D:\Program files\metatrader 5\terminal.exe /portable

 

this is what i get

 

Files:
pic1.jpg  221 kb
 

from the windows start command I started the terminal with /portable and I get those paths:

TERMINAL_COMMONDATA_PATH = C:\ProgramData\MetaQuotes\Terminal\Common
TERMINAL_DATA_PATH = D:\Program Files\MetaTrader 5
TERMINAL_PATH = D:\Program Files\MetaTrader 5

but now I get 4802 even if the ex5 indicator exist in "D:\program files\metatrader 5\indicators" and also in "C:\ProgramData\MetaQuotes\Terminal\Common".

both cases I get the -1 handle with 4802. 


 

 

Rosh -

 I'm sorry, when starting from the start command with /portable it works fine from TERMINAL_PATH.

Can the indicator be operated from a sub-folder in TERMINAL_PATH(D:\Program files\MetaTrader 5\Indicators\My Indicators)?

 

Thanks 

Reason: