I have a solution, I know this is 3 year later. But I will add this solution if anyone else has this problem.
I had the same [4802] Error , including an iCustom() indicator as a #resource, into my EA , I only saw this error when using Strategy Tester or putting on a Live Chart .
My EA compiled no with no errors.
#resource "\\Indicators\\testing123\\My_Custom_ind.ex5" int handle_ind; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { string indicatorName1 = "::Indicators\\testing123\\My_Custom_ind.ex5"; handle_ind = iCustom(_Symbol,_Period, indicatorName1,); if(handle_ind == INVALID_HANDLE) { Print("Expert: iCustom call: Error code=",GetLastError()); return(INIT_FAILED); } //--- return(INIT_SUCCEEDED); }
MY EA would not load on my PC, on Live charts or in Strategy Tester despite, compiling with No Errors.
However I pasted the same EA .ex5 file in my other MT5 terminal on my VPS. Guess What ? No Problems at all, Backtests, Live, all good, custom indicator is inside the .ex5 file.
Both PC and VPS are running MT5 build 3980 21 Sep 2023
My PC - Windows 10 64Bit
VPS - Windows Server 2022 64-Bit (like windows 10)
Solution: I think this is to do with how our operating system is configured. I will try to figure it out.
![Documentation on MQL5: MQL5 programs / Resources Documentation on MQL5: MQL5 programs / Resources](https://c.mql5.com/36/79/documentation-on-mql5-mql5-programs__8.png)
- www.mql5.com
Aha! I have found the solution:
MT5 does not like Long lettered destination folders and long names for EAs.
Once compiled your EA (with compiled iCustom indicator), copy or move it to another folder, closer to the MQL5 folder, give it a short name too.
All my EAs on the VPS are in location: C: ... \ MQL5\Expert
On My PC the location was : C: ... \MQL5\Experts\testing123\stripped_down_corrected\Day_Time_Filter\Live_Darwinex < very long location indeed
I found the solution here thanks to @Davi Santos Da Silva, but his answer was shot down by others.
Forum on trading, automated trading systems and testing trading strategies
Call to custom indicator suddently stopped working
Davi Santos Da Silva, 2021.02.03 02:27
I think I know what may be happening. The path that mt5 creates to execute the indicator #resource is very long and this could be causing a failure. Try to rename the indicator to the smallest possible name and do a test.![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
this is my report on a problem that started to happen with me some days ago and also the solution I found. I hope it might reach Metaquotes so they find a solution to this obvious bug (even though my situation with another of such problems gives me little hope for that).
So what happened is that I had this perfectly working indicator I developed earlier. In a later moment, I decided to create another indicator that would call the first one with iCustom with it loaded as a resource. So as someone who kinda knows how to do this - I lost the count already on how many times have I loaded indicators this way -, I just copied and pasted the 'calling code' from another similar project whick worked fine. The final code compiled just fine.
Unfortunately, as soon as I tried to run it attaching it to a graph in a demo account, error 4802 appeared. I was totally surprised. The indicator being called was perfectly functional and had already being loaded by a second indicator in previous works. In fact, that was the source for my copy and paste of a, therefore, successfull call to it. So why would it be that the exact same iCustom call of that exact same indicator was now not working? And yeah, I checked, the source of copy and paste was still working fine after recompiling.
I checked everything I could, recompiled everything I could, and nothing changed; error 4802 just wouldn't go away every time I put the new indicator into a Graph. I was already thinking about coming here to call for help when I started to ask myself if there wasn't any part of the new indicator's code that was being the source of the problem. After all, the iCustom and related lines were 100% correct. So I created another mq5 file and started to copy and paste part by part of the indicators code into it and recompile and attach to a graph. For my total surprise, by the end of the operation I had an exact same copy of the main file of my indicator working perfectly in my Demo account. Two exact same main mq5 files, one giving error and one not. For me, the conclusion was obvious: the project file was problematic.
So I erased my project file and created a new one, the rest of the code was the same. I recopiled and attached to a graph and now everything worked fine. My conclusion was that when adding the new indicator as a resource, the project file got buggy and created the problem.
And this didn't happen only once. A couple of days later I did the same move of adding a call to a indicator with iCustom in another project of mine, but this time it was an Expert Advisor. The same 4802 error appeared when I attached it to a graph. I copied and pasted the whole main mq5 code with the iCustom call to another empty file, compiled it and it worked fine. So I deleted the project file, created a new one and the EA went back to work fine.
Conclusion: the project file MT5 creates is not handling resources properly, or at least when they are indicators later called with iCustom.