Call to custom indicator suddently stopped working

Martin Bittencourt
1525
Martin Bittencourt  

Hi,

I'm facing a strange issue here. I have an Expert Advisor, "Main EA", which loads a custom indicator, "MW MSSS Rev Hammer.ex5" with iCustom. The whole code is stable for weeks and for weeks I have been doing backtestings without changing the indicator's source file, only the Main EA and even so minor things. 

Yesterday, after I had do recompile due to a minor change in Main EA (just a new input parameter that is almost not used in the code), it suddently started to give errors of "failing to load resource" and pointing out to my indicator.


DF      2       21:50:55.256    Core 11 2016.02.01 00:00:00   cannot load resource 'C:\Users\marti\AppData\Roaming\MetaQuotes\Tester\038C9E8FAFF9EA373522ECC6D5159962\Agent-127.0.0.1-3010\MQL5\Experts\Martinware\Main EA\Martinware - Main EA.ex5::Indicators\Martinware\MSSS\MW MSSS Rev Hammer.ex5'
CI      2       21:50:55.256    Core 11 loading of MW MSSS Rev Hammer WIN$N,M30 failed [554]
NK      2       21:50:55.256    Core 11 2016.02.01 00:00:00   cannot load custom indicator 'C:\Users\marti\AppData\Roaming\MetaQuotes\Tester\038C9E8FAFF9EA373522ECC6D5159962\Agent-127.0.0.1-3010\MQL5\Experts\Martinware\Main EA\Martinware - Main EA.ex5::Indicators\Martinware\MSSS\MW MSSS Rev Hammer.ex5' [4802]
MD      2       21:50:55.256    Core 11 2016.02.01 00:00:00   indicator create error
LP      2       21:50:55.256    Core 11 OnInit critical error
HE      2       21:50:55.256    Core 11 tester stopped because OnInit failed


This error is killing me. As I sad, the changes I made before this problem start appearing were minor and I have already rolled back the code without getting a fix. The only major event before this was an update of MT5 version to the recent build 2650. The update was done at 9 October and that is the same date of my last commit in the repository. Since then, the only new compiling was the mentioned above with the minor change which I already rolled back without being able to fix the problem.

Since there was a change in the MT5 build, I recompiled everything related to the MSSS indicator and Main EA once again after that, but the problem persists. I'm starting to think there might be a bug in this new MT5 build :/ but I couldn't find anybody else mentioning having a similar problem in this website. 

So, any help fixing this issue? Never forgetting: it was functioning perfectly until the last recompiling and the changes made were already rolled back without me getting a fix in my problem.

EDIT:

Two extra info that might help. First, the MSSS indicator continues to work fine when attached independetly into a graph. Second, I noticed that if I open the project in the Navigator and manually remove the MSS indicator from the resources section there and recompile my Main EA and then run it in the Tester, I'm able to succesfully make it run again. If, though, I call it to be recompiled again and this time I don't previously delete my MSSS indicator in the Resources section and try again, the problem comes back. My gosh if that is not a bug in this latest MT5 version, I have no idea what it is!

Step on New Rails: Custom Indicators in MQL5
Step on New Rails: Custom Indicators in MQL5
  • www.mql5.com
Finally we've got an opportunity to try the new trade terminal - MetaTrader 5 . No doubt, it is noteworthy and has many new features as compared to its predecessor. The important advantages of this platform among others are: Essentially modified language allowing now to use the object-oriented programming, still allowing to use the rich...
Martin Bittencourt
1525
Martin Bittencourt  
No one knows how to solve this? :( I'm being unable to work in my EA for a week now T_T
William Roeder
23803
William Roeder  

Martin Bittencourt: it suddently started to give errors of "failing to load resource" and pointing out to my indicator.

cannot load resource 'C:\Users\marti\AppData\Roaming\MetaQuotes\Tester\038C9E8FAFF9EA373522ECC6D5159962\Agent-127.0.0.1-3010\MQL5\Experts\Martinware\Main EA\Martinware - Main EA.ex5::Indicators\Martinware\MSSS\MW MSSS Rev Hammer.ex5'

You have no resource at that location. Put your indicator resource in the «data folder»\indicator folder and then recompile.

Martin Bittencourt
1525
Martin Bittencourt  
William Roeder:

You have no resource at that location. Put your indicator resource in the «data folder»\indicator folder and then recompile.

Hi,

thanks for the reply. Unfortunately, your suggestion is impossible to be true. Whenever an appointed resource in not in the specified file path, the project don't even compile. 

Example

Proof above: I have the exact same indicator (just with different name) in the exact same file path. I deleted the file and put to recompile and it didn't go. That doesn't happen with my problem: it does compile perfectly fine, the problem appears when trying to run in the Tester.

That being sad, it's true that if I try to go to that filepath, the full path doesn't exit; the best I can do is up to the MQL5 folder: C:\Users\marti\AppData\Roaming\MetaQuotes\Tester\038C9E8FAFF9EA373522ECC6D5159962\Agent-127.0.0.1-3010\MQL5. The "Experts" folder don't exist here. But I assume this isn't a problem, rather how MQL5 works: when it is going to do the testing, it creates the folder and put the EA with all its stuff in that folder. Moreover it's relevant to notice that this EA has more a dozen of custom indicators, all of them loaded as resources, and this problem doesn't occurr with them (and they are loaded first). 


//--- resources
//#resource "\\Indicators\\Martinware\\MW Tops and Bottoms Dec Int.ex5"
//#resource "\\Indicators\\Martinware\\MW Bollinger Band Percent.ex5"
//#resource "\\Indicators\\Martinware\\MW Bollinger Band Width.ex5"
#resource "\\Indicators\\Martinware\\MW Congestion Detector A.ex5"
#resource "\\Indicators\\Martinware\\MW Congestion Detector B.ex5"
//#resource "\\Indicators\\Martinware\\MW Moving Average Inclination.ex5"
//#resource "\\Indicators\\Martinware\\MW Price Direction.ex5"
#resource "\\Indicators\\Martinware\\SRaFR\\MW SRaFR Free.ex5"
#resource "\\Indicators\\Martinware\\Vol\\MW Volume.ex5"
#resource "\\Indicators\\Martinware\\ADE\\MW Average of Daily Extremes.ex5"
#resource "\\Indicators\\Martinware\\DI\\MW Didi Index.ex5"
#resource "\\Indicators\\Martinware\\Sto\\MW Stochastic.ex5"
#resource "\\Indicators\\Martinware\\DCBA\\MW DCBA.ex5"
#resource "\\Indicators\\Martinware\\- Unfinished\\MW Sensible DCBA.ex5"
#resource "\\Indicators\\Martinware\\3DCBA\\MW 3 DCBAs Direction.ex5"
#resource "\\Indicators\\Martinware\\VVMA\\MW VVMA.ex5"
#resource "\\Indicators\\Martinware\\MSSaA\\MW MSS as Arrows.ex5"
#resource "\\Indicators\\Martinware\\PTSV\\MW PTSV.ex5"
#resource "\\Indicators\\Martinware\\SDE\\MW SDE.ex5"
#resource "\\Indicators\\Martinware\\MW Clouds.ex5"
#resource "\\Indicators\\Martinware\\MW 3 MAs Direction.ex5"
#resource "\\Indicators\\Martinware\\MW Current Volatility.ex5"
#resource "\\Indicators\\Martinware\\MW Biggest Volatility.ex5"

#resource "\\Indicators\\Martinware\\MSSS\\MW MSS Tests.ex5"
KN      1       15:06:55.360    Core 09 2020.10.01 00:00:00   Cannot load 'C:\Users\marti\AppData\Roaming\MetaQuotes\Tester\038C9E8FAFF9EA373522ECC6D5159962\Agent-127.0.0.1-3008\MQL5\Libraries\sqlite3_32.dll' [193]
QK      2       15:06:55.360    Core 09 2020.10.01 00:00:00   cannot load resource 'C:\Users\marti\AppData\Roaming\MetaQuotes\Tester\038C9E8FAFF9EA373522ECC6D5159962\Agent-127.0.0.1-3008\MQL5\Experts\Martinware\Main EA\Martinware - Main EA.ex5::Indicators\Martinware\MSSS\MW MSS Tests.ex5'
OE      2       15:06:55.360    Core 09 loading of MW MSS Tests WIN$N,M30 failed [554]
OP      2       15:06:55.360    Core 09 2020.10.01 00:00:00   cannot load custom indicator 'C:\Users\marti\AppData\Roaming\MetaQuotes\Tester\038C9E8FAFF9EA373522ECC6D5159962\Agent-127.0.0.1-3008\MQL5\Experts\Martinware\Main EA\Martinware - Main EA.ex5::Indicators\Martinware\MSSS\MW MSS Tests.ex5' [4802]
LE      2       15:06:55.360    Core 09 2020.10.01 00:00:00   indicator create error
OS      2       15:06:55.360    Core 09 OnInit critical error
CJ      2       15:06:55.360    Core 09 tester stopped because OnInit failed
FS      2       15:06:55.375    Core 09 disconnected
GJ      0       15:06:55.375    Core 09 connection closed

And finally: remember this EA with this indicator worked fine until I updated my MQL5 to the lastest version and recompiled it. I did many backtestings using this indicator for weeks and everything worked fine and I didn't change any folder in the mean time.

Martin Bittencourt
1525
Martin Bittencourt  

Well, things got even more interesting now.

Even though I haven't made any change in my indicator right before the bug started, I decided to check if there could be anything in its code that would somehow be incompatible with the new MQL5 version. So after copying the code, I started to remove parts of it and test if the bug has being solved. Suprinsigly, that went to the point that I barely had any indicator whatosever and yet the bug persisted:

#property copyright "(Martin Bittencourt)"
#property link      "https://www.mql5.com"
#property version "1.0"

#property description "This indicator plots setups"
//#property icon "Logo-1-Small.ico";

//---- indicator settings
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_plots   1

//--- plot Bullish
#property indicator_label1  "Bullish"
#property indicator_type1   DRAW_CANDLES
#property indicator_color1  clrGray
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1

//--- defines

//--- indicator buffers
double BullishBuffer1[];
double BullishBuffer2[];
double BullishBuffer3[];
double BullishBuffer4[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
   SetIndexBuffer(0,BullishBuffer1,INDICATOR_DATA);
   SetIndexBuffer(1,BullishBuffer2,INDICATOR_DATA);
   SetIndexBuffer(2,BullishBuffer3,INDICATOR_DATA);
   SetIndexBuffer(3,BullishBuffer4,INDICATOR_DATA);
   
//---   
   return INIT_SUCCEEDED;
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{

//--- return value of prev_calculated for next call
   return(rates_total);
}
//+------------------------------------------------------------------+

Even with the simple code above, I still get the bug. This seems to suggest that maybe something went wrong during the update and I'll need to reinstall MQL5 Terminal again. Does anybody has any suggestions before I use that radical approach?

Davi Silva
1293
Davi Silva  

I do have the same problem


#resource "gann_hi_lo_activator_ssl.ex5"

int bf_hilo = INVALID_HANDLE;

bf_hilo = iCustom(_Symbol,hiloTF,"::gann_hi_lo_activator_ssl.ex5");


Its not working anymore after October mt5 updates, if i remove the :: or try in a older mt5/mql5 version its working.

I already Try to update, reinstall, other brokers and other computer, but still persist. 

Martin Bittencourt
1525
Martin Bittencourt  
Davi Silva:

I do have the same problem



Its not working anymore after October mt5 updates, if i remove the :: or try in a older mt5/mql5 version its working.

I already Try to update, reinstall, other brokers and other computer, but still persist. 

Well it's not nice to say this, but finally someone who has the same problem! ^.^ I guess it is, indeed, a bug in the recent updates, and so or only hope is for Metaquotes to quickly correct it. 

And btw thanks for noting that reinstalling didn't solve the issue; it certainly saved me from waisting my time with that approach!

Martin Bittencourt
1525
Martin Bittencourt  
Final question, then: how do I report this bug? I noted the Service Desk only handles financial/payment stuff now and I suppose MetaQuotes doesn't read all the posts in the Forum so they would note this one.
kcunaz
32
kcunaz  

I have the Kangaroo Tail Non-Robot

indicator for the life of me I can not get it to work on this MT5 my MT4 just fine, is any one else having this problem

Martin Bittencourt
1525
Martin Bittencourt  
kcunaz:

I have the Kangaroo Tail Non-Robot

indicator for the life of me I can not get it to work on this MT5 my MT4 just fine, is any one else having this problem

i'm under the impression this is another problem, thus should be treated in a different thread.

Now, back to the problem: yesterday there was a new MT5 update and I saw no mention of this bug being corrected. How can I tell Metaquotes about this problem?

mv6278
14
mv6278  

Hello,

I'm facing the same issue. I've created a post some days ago about this but no solutions so far. This problem also happens if an indicator loads another indicators as resources in iCustom. The workaround to make it work is:

  1. On MetaEditor, go to your project's "Resources" folder and remove the references to all ex5 resources
  2. Compile the project again. This should make the EA work.
  3. However, if you compile the project again, the error comes back. Then, you need to repeat the steps above.

I noticed this problem several weeks ago and I hoped that it would be fixed in later MT5 versions, but this haven't happened.  I can't tell when it began but I suspect it might have started after release 2485 because the release notes mention changes in iCustom (https://www.metatrader5.com/en/releasenotes/terminal/2145)

Here's how to reproduce the problem. First, create a sample indicator:

//+------------------------------------------------------------------+
//|                                              SampleIndicator.mq5 |
//|                                                                  |
//+------------------------------------------------------------------+

input int InputA = 0;
input int InputB = 0;

int OnInit()
{   
   return INIT_SUCCEEDED;
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   return rates_total;
}

Then, create a sample EA to load this indicator (place the compiled SampleIndicator.ex5 file in the same folder as the SampleEA):

//+------------------------------------------------------------------+
//|                                                     SampleEA.mq5 |
//|                                                                  |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+

#resource "SampleIndicator.ex5"

#define TEST1

int OnInit()
{
   #ifdef TEST1
      // This example works if SampleIndicator.ex5 is located in the same
      // folder as SampleEA.ex5. This works, but you need to distribute 
      // both files, (SampleIndicator.ex5 and SampleEA.ex5), 
      // which is not what I want to do      
      int handle = iCustom (NULL, 0, "SampleIndicator.ex5", 0, 0);
   
   #else
      // This example used to work fine and now it's broken. In this example you
      // distribute only the SampleEA.ex5 file as the SampleIndicator.ex5 file
      // is compiled in the SampleEA.ex5 file as resource.      
      int handle = iCustom (NULL, 0, "::SampleIndicator.ex5", 0, 0);
      
   #endif 
   
   PrintFormat ("handle = %d, error = %d", handle, GetLastError());
   
   return INIT_SUCCEEDED;
}

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{  
}


I attached the project files in this post. I hope this helps to solve the issue.

MetaTrader 5 build 2485: iCustom improvements and overall optimization in MQL5
MetaTrader 5 build 2485: iCustom improvements and overall optimization in MQL5
  • 2020.06.05
  • MetaQuotes Software Corp.
  • www.metatrader5.com
Optimized and significantly accelerated bar history editing for custom financial instruments. The improvement also concerns the CustomRatesUpdate function. Fixed exporting of custom symbol settings to a JSON file. Fixed errors reported in crash logs. This version features a revised custom indicator loading algorithm via iCustom. If the...
Files:
SampleEA.zip 34 kb