Error loading indicador as resource in Strategy Tester

mv6278
14
mv6278  

Hello, 


Summary:

I have an EA that loads several indicators as resources, and I've been using this EA since last year. My EA has been working correctly in the Strategy Tester until a recent MT5 release (I don't remember exactly which one), when I began receiving resource loading errors in iCustom. I thought this could be a temporary error and decided to wait for newer MT5 releases to see if this error got resolved. However, I tested with build 2670 (04 Nov 2020) and the error still persists. I wrote a sample EA and a sample Indicator to reproduce the issue when running it in the Strategy Tester. Here are the  messages:

cannot load resource 'C:\Users\Luis\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\MQL5\Experts\Luis\SampleEA\SampleEA.ex5::Sample.ex5'

loading of SampleEA.ex5::Sample WINZ20,M1 failed [554]

SampleEA (WINZ20,M1) 2020.10.19 00:00:00   cannot load custom indicator 'C:\Users\Luis\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\MQL5\Experts\Luis\SampleEA\SampleEA.ex5::Sample.ex5' [4802]

SampleEA (WINZ20,M1) 2020.10.19 00:00:00   indicator create error

Tester OnInit critical error


Sample EA

// sample indicator ex5 file
#resource "Sample.ex5"

int OnInit()
{
   int handle = iCustom (NULL, 0, "::Sample.ex5", 0, 0);
   
   PrintFormat ("handle = %d, error = %d", handle, GetLastError());

   return INIT_SUCCEEDED;
}

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

Sample Indicator


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;
}


I'm wondering how to solve this issue, as this code was working perfectly until recent MT5 releases.


Thank you

The Fundamentals of Testing in MetaTrader 5
The Fundamentals of Testing in MetaTrader 5
  • www.mql5.com
The idea of ​​automated trading is appealing by the fact that the trading robot can work non-stop for 24 hours a day, seven days a week. The robot does not get tired, doubtful or scared, it's is totally free from any psychological problems. It is sufficient enough to clearly formalize the trading rules and implement them in the algorithms, and...
William Roeder
23782
William Roeder  
mv6278: 'C:\Users\Luis\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\MQL5\Experts\Luis\SampleEA

You can't read an EA with iCustom.
          Use the publicly released code - MQL5 programming forum 2017.02.20
          Resources - MQL4 Reference

Be aware that using resources is 40x times slower than using CIs directly.
          A custom indicator as a resource - MQL4 programming forum 2019.11.26

Also make use there are no spaces in the path.
          Getting error 4802 when loading custom indicator that loads another custom indicator with iCustom - Technical Indicators - MQL5 programming forum. 2020.07.21

mv6278
14
mv6278  
William Roeder:

You can't read an EA with iCustom.
          Use the publicly released code - MQL5 programming forum 2017.02.20
          Resources - MQL4 Reference


Be aware that using resources is 40x times slower than using CIs directly.
          A custom indicator as a resource - MQL4 programming forum 2019.11.26

Also make use there are no spaces in the path.
          Getting error 4802 when loading custom indicator that loads another custom indicator with iCustom - Technical Indicators - MQL5 programming forum. 2020.07.21

Hello William,

Pardon me if my messages were not clear. My EA runs on MT5, not MT4. My EA is product that uses several indicators that I have developed. I don't want to distribute the indicatores separately (and for my product, this does not make sense). So I included all indicators as resources in my EA to distribute the EA only. 

I'm not trying to read an EA with iCustom -- the EA uses iCustom to load my indicators (only once per indicator). My EA has been working well since I've written it (last year), and I've been modifying it throughout this year with no issues.  However, recently I had to make changes in my EA and I started receiving errors ("cannot load resource") when trying to load it in the Strategy Tester. The changes I made had nothing to do with the resource loading part.

The sample code I provided here makes it possible to reproduce the issue.  Sometimes I can make the EA work if I delete all ex5 resources in MetaEditor's navigator window and compile the project again, which is weird. In this situation, if I make any changes to the code and compile again, the "cannot load resource" error comes again.

Summing up: I had something that was working perfectly, then I got a MT5 update, compiled my project with the new version, and started getting this error.


Thank you

mv6278
14
mv6278  
There are more people facing this issue: https://www.mql5.com/en/forum/353276
Call to custom indicator suddently stopped working
Call to custom indicator suddently stopped working
  • 2020.10.13
  • www.mql5.com
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...