Error 4802 is killing me

 

I am posting here because I am totally out of ideas.  I'm trying to get an EA that I have to correctly call one of my indicators.  I have tried every possible thing I can think of, and nothing I do will work.  The problem is that when I call IndicatorCreate(), I always get error 4802.


Here is the relevant info if someone can help me debug it:


EA code:


                MqlParam    prdParams[];
                
                ArrayResize(prdParams, 5);
                prdParams[0].type = TYPE_STRING;
                prdParams[0].string_value = "PRD";
                prdParams[1].type = TYPE_INT;
                prdParams[1].integer_value = PRDLength;
                prdParams[2].type = TYPE_DOUBLE;
                prdParams[2].double_value = 1.0;
                prdParams[3].type = TYPE_DOUBLE;
                prdParams[3].double_value = PRDDeviation;
                prdParams[4].type = TYPE_DOUBLE;
                prdParams[4].double_value = 3.0;
                
                prd15_handle = IndicatorCreate(NULL, PERIOD_M15, IND_CUSTOM, 5, prdParams);
                if (prd15_handle == INVALID_HANDLE) {
                    Print("Indicator error: ", IntegerToString(GetLastError()));
                }
Documentation on MQL5: Timeseries and Indicators Access / IndicatorCreate
  • www.mql5.com
Timeseries and Indicators Access / IndicatorCreate - Documentation on MQL5
 

Crap, I didn't finish my previous post.


Here is the error message:

RD	0	Core 1	03:13:21	2010.08.02 01:12:00   CVirtualOrderManager::Initialise - System ID or Magic Number is 48079210334
CL	0	Core 1	03:13:21	2010.08.02 01:12:00   Lot Decimal: 2
IR	2	Core 1	03:13:21	loading of PRD EURUSD,M15 failed
JH	2	Core 1	03:13:21	2010.08.02 01:12:00   Expert removed because indicator create error
NL	0	Core 1	03:13:21	2010.08.02 01:12:00   Indicator error: 4802
OJ	2	Core 1	03:13:21	loading of PRD EURUSD,H1 failed
FN	2	Core 1	03:13:21	2010.08.02 01:12:00   Expert removed because indicator create error
JS	0	Core 1	03:13:21	2010.08.02 01:12:00   Indicator error: 4802
OH	0	Core 1	03:13:21	OnTester result 0
RJ	0	Core 1	03:13:21	EURUSD,M15: 0 ticks (1 bars) generated within 0 ms (total bars in history 38820)
JI	1	Core 1	03:13:21	2010.08.02 01:12:00   5 undeleted objects left
NM	1	Core 1	03:13:21	2010.08.02 01:12:00   384 bytes of leaked memory

I have tried the suggestions here:

https://www.mql5.com/en/forum/696

but nothing works.


I have my indicator called PRD.ex5 in many different directories:


C:\Program Files\MetaTrader 5\MQL5\Indicators

C:\Users\Ken\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Indicators


All are complied properly, and this indicator works fine when I attach it to any chart.


My OS is Win7 Enterprise, 64-bit.  I have user write permissions on the MT5 folder under Program Files.


I just need to know where MT5 is looking for the indicator, and where I am supposed to put it.  The documentation here

https://www.mql5.com/en/docs/series/indicatorcreate

is either wrong, or the tool has a bug. 


I am so frustrated that I'm now trying to get a system call tracer utility for windows to try and see what MT5 is doing, and where it is looking for the indicator.

Indicatorecreate returns err # 4802 - ERR_INDICATOR_CANNOT_CREATE
  • www.mql5.com
I wrote a pivot indicator which when attached to a graph plots the pivots according to a timeframe parameter.
 

Please write new request using ServiceDesk.

Please, describe your problem as full as it possible and attach sources of indicator and EA. 

 

Try put .ex5 extension: 

 prdParams[0].string_value = "PRD.ex5";

 

Here a hint from docs: 

'The custom indicator must be compiled (file with EX5 extension) and located in the directory MQL5/Indicators of the client terminal or in a subdirectory.'

Step on New Rails: Custom Indicators in MQL5
  • 2009.11.23
  • Андрей
  • www.mql5.com
I will not list all of the new possibilities and features of the new terminal and language. They are numerous, and some novelties are worth the discussion in a separate article. Also there is no code here, written with object-oriented programming, it is a too serous topic to be simply mentioned in a context as additional advantages for developers. In this article we will consider the indicators, their structure, drawing, types and their programming details, as compared to MQL4. I hope that this article will be useful both for beginners and experienced developers, maybe some of them will find something new.
 
tektronic:

Try put .ex5 extension: 

 prdParams[0].string_value = "PRD.ex5";

 

Here a hint from docs: 

'The custom indicator must be compiled (file with EX5 extension) and located in the directory MQL5/Indicators of the client terminal or in a subdirectory.'

Thanks for your suggestion, but no luck.


I will try opening a ticket and see if we get progress.


 

alexvd:

Please write new request using ServiceDesk.

Please, describe your problem as full as it possible and attach sources of indicator and EA. 

Hello Alex,


I have created a Service request ID: 20885.

Thank you for your prompt attention.


 
silverpike:

I am posting here because I am totally out of ideas.  I'm trying to get an EA that I have to correctly call one of my indicators.  I have tried every possible thing I can think of, and nothing I do will work.  The problem is that when I call IndicatorCreate(), I always get error 4802.


Here is the relevant info if someone can help me debug it:


EA code:


I had the same persistent error on Win 7 x64. There is a hint (bug or feature?) in the documentation that you will need to allocate an additional param to your param array. The relevant section in the IndicatorCreate doc reads such:

If the first form of the call is used in a custom indicator, you can additionally indicate as the last parameter on what data it will be calculated when passing input parameters. If the "Apply to" parameter is not specified explicitly, the default calculation is based on the PRICE_CLOSE values.

So then, the following might work in your case (It worked for me):

                MqlParam    prdParams[];
                
                ArrayResize(prdParams, 6);
                prdParams[0].type = TYPE_STRING;
                prdParams[0].string_value = "PRD";
                prdParams[1].type = TYPE_INT;
                prdParams[1].integer_value = PRDLength;
                prdParams[2].type = TYPE_DOUBLE;
                prdParams[2].double_value = 1.0;
                prdParams[3].type = TYPE_DOUBLE;
                prdParams[3].double_value = PRDDeviation;
                prdParams[4].type = TYPE_DOUBLE;
                prdParams[4].double_value = 3.0;

                prd15_handle = IndicatorCreate(NULL, PERIOD_M15, IND_CUSTOM, 6, prdParams);
                if (prd15_handle == INVALID_HANDLE) {
                    Print("Indicator error: ", IntegerToString(GetLastError()));
                }
 

I wanted to update this thread with the results.  I did get a solution, but I think the solution is ridiculous.  As far as I can tell, it's some kind of undocumented workaround (I can find no mention of it anywhere in the docs).


I added the following code to the top of my EA.


#property tester_indicator "PRD.ex5"
 

 I had the same problem with Build 441 (latest today), but you Silverpike just made my day! Thank you! I spent hours trying and searching till I found this post. Now I really want to scream laud all the bad words I know. Looks like they have just ignored your error report 9 moths ago in service desk. At least they could update help file with some information about it.

 Will see what they will write in their next article about writing your own CustomSignal for MQL5 Wizard. I have created my own SignalCustom.mqh by using Custom.mqh and I'm able to select and generate ExpertAdvisors with it but this last thing took me all day today. And other bad thing is that I will not be able to crate indicator name as input parameter because CrateIndicator() will just fail. 

 /tsaktuo 

MQL5 Wizard: Creating Expert Advisors without Programming
  • 2011.01.11
  • MetaQuotes Software Corp.
  • www.mql5.com
Do you want to try out a trading strategy while wasting no time for programming? In MQL5 Wizard you can simply select the type of trading signals, add modules of trailing positions and money management - and your work is done! Create your own implementations of modules or order them via the Jobs service - and combine your new modules with existing ones.
 
tsaktuo:

 I had the same problem with Build 441 (latest today), but you Silverpike just made my day! Thank you! I spent hours trying and searching till I found this post. Now I really want to scream laud all the bad words I know. Looks like they have just ignored your error report 9 moths ago in service desk. At least they could update help file with some information about it.

 Will see what they will write in their next article about writing your own CustomSignal for MQL5 Wizard. I have created my own SignalCustom.mqh by using Custom.mqh and I'm able to select and generate ExpertAdvisors with it but this last thing took me all day today. And other bad thing is that I will not be able to crate indicator name as input parameter because CrateIndicator() will just fail. 

 /tsaktuo 

Described in the documentation

tester_indicator

string

Name of a custom indicator in the format of "indicator_name.ex5". Indicators that require testing are defined automatically from the call of the iCustom() function, if the corresponding parameter is set through a constant string. For all other cases (use of the IndicatorCreate() function or use of a non-constant string in the parameter that sets the indicator name) this property is required

 

 
stringo:

Described in the documentation

tester_indicator

string

Name of a custom indicator in the format of "indicator_name.ex5". Indicators that require testing are defined automatically from the call of the iCustom() function, if the corresponding parameter is set through a constant string. For all other cases (use of the IndicatorCreate() function or use of a non-constant string in the parameter that sets the indicator name) this property is required

 

Thank you! I found it later too. But I have a problem - I have created multiple Signals for MQL Wizard and:

1) I can not combine them because only one tester_indicator can be used; 

2) This parameter can not be added in Signal include file but must be added in Expert. Therefore I will not be able to provide it to others in MQL5 homepage (because they will need to know how to add it manually in generated output file).

 

/tsaktuo 

Reason: