Download MetaTrader 5

Indicatorecreate returns err # 4802 - ERR_INDICATOR_CANNOT_CREATE

To add comments, please log in or register
Amir Yacoby
1195
Amir Yacoby 2010.03.28 03:34 

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? 

Alexey Da
Moderator
6657
Alexey Da 2010.03.30 16:10  
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.

Amir Yacoby
1195
Amir Yacoby 2010.03.30 17:04  

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. 

Rashid Umarov
Admin
11989
Rashid Umarov 2010.03.30 17:05  
I suspect there is not custom indicator 'My Pivots Indicator.mq5' in terminal_folder/MQL5/Indictor.

Amir Yacoby
1195
Amir Yacoby 2010.03.31 00:04  

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. 

Rashid Umarov
Admin
11989
Rashid Umarov 2010.03.31 04:10  

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



Amir Yacoby
1195
Amir Yacoby 2010.03.31 10:09  

It's windows 7. Parameter is not valid.

Rashid Umarov
Admin
11989
Rashid Umarov 2010.03.31 10:30  
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


Amir Yacoby
1195
Amir Yacoby 2010.03.31 11:05  

this is what i get

 

Files:
pic1.jpg 221 kb
Amir Yacoby
1195
Amir Yacoby 2010.03.31 11:11  

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. 


 

Amir Yacoby
1195
Amir Yacoby 2010.03.31 11:45  

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 

12
To add comments, please log in or register