Call to custom indicator suddently stopped working - page 2

 
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:

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


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

Thanks for the contribution. Having the same problem, I also managed to successfully run the application in the way you mentioned. The problem is that it works only once: for example, if you do backtesting, that won't be enough. Plus my project has quite a number of .ex5 on it, so that workaround is quite boring!

I was hoping there was a way to contact Metaquotes to give bug feedbacks, but so far it seems the only feedback available is for monetary issues :/

 
Any news about this issue?
 
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.
 
Davi Silva:
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.

Hi Davi,

I don't think this is the solution because:

1) this problem appeared after a MT5 release around October last year  (I cant' tell which one exactly as we cannot use those versions again). I have been using resource loading to load my indicators  when the EA starts up since Sept/2019 and I had no issues until those MT5 releases

2) If I remove all ex5 resources from the project (in the navigator window) and compile the project again, I'm able to start the EA and load my indicators. However, if I compile the project after this (it doesn't matter if I make changes or not to code), the error comes again. Then I have to repeat the process of removing all .ex5 files and compiling the project again to have this working again

 
mv6278:

Hi Davi,

I don't think this is the solution because:

1) this problem appeared after a MT5 release around June-October last year  (I cant' tell which one exactly as we cannot use those versions again). I have been using resource loading to load my indicators  when the EA starts up since Sept/2019 and I had no issues until those MT5 releases

2) If I remove all ex5 resources from the project (in the navigator window) and compile the project again, I'm able to start the EA and load my indicators. However, if I compile the project after this (it doesn't matter if I make changes or not to code), the error comes again. Then I have to repeat the process of removing all .ex5 files and compiling the project again to have this working again

It's a "project" issue. It's buggy and unusable for any real complex project.
 
Alain Verleyen:
It's a "project" issue. It's buggy and unusable for any real complex project.

Hi Alain, 


What do you mean by "it's a project issue"? Do you mean that this feature (using ex5 files in EAs) is buggy in MT5, or do you mean that our projects are buggy and not using this feature correctly?

I've been using resources to pack my indicators (as ex5 files) inside an EA for over an year in a complex project, then I supply only the EA for the users.  Supplying each indicator file individually is not an option, as the EA is a product that requires and uses the indicators included as resources. The indicators are loaded only once when the EA starts up. Only after Oct/2020 MT5 releases that the issue reported in this thread started to happen. If you know another way to pack indicators in a EA, please let us know, I will be glad to hear it.


Thanks

 
mv6278:

Hi Alain, 


What do you mean by "it's a project issue"? Do you mean that this feature (using ex5 files in EAs) is buggy in MT5, or do you mean that our projects are buggy and not using this feature correctly?

I've been using resources to pack my indicators (as ex5 files) inside an EA for over an year in a complex project, then I supply only the EA for the users.  Supplying each indicator file individually is not an option. The indicators are loaded only once when the EA starts up. Only after Oct/2020 MT5 releases that the issue reported in this thread started to happen. If you know another way to pack indicators in a EA, please let us know, I will be glad to hear it.


Thanks

I mean a project issue. In MetaEditor you have a feature called "project".

Include you indicator(s) in your EA without using a project. I deleted the project, I placed the indicator in MQL5\\Indicators folder.

#resource "\\Indicators\\SampleIndicator.ex5"

#define TEST19

int OnInit()
{
   #ifdef TEST1
      // this works
      int handle = iCustom (NULL, 0, "SampleIndicator.ex5", 0, 0);
   
   #else

      // this generates resource loading error 
      int handle = iCustom (NULL, 0, "::Indicators\\SampleIndicator.ex5");
      
   #endif 
   
   PrintFormat ("handle = %d, error = %d", handle, GetLastError());
   
   return INIT_SUCCEEDED;
}

The project feature is buggy and useless, it has been reported to Metaquotes but they don't care.

Обсудим совместные проекты в редакторе - зачем они и куда движутся
Обсудим совместные проекты в редакторе - зачем они и куда движутся
  • 2018.01.20
  • www.mql5.com
На текущий момент мы выпустили первую версию проектов, совместных проектов и новое хранилище...
 

Hi Alain,


Thanks for the clarification. I understand now you're referring to "project feature" as the mqproj files, the Project tab in MetaEditor, and the project settings window. I was not adding the indicators through the project feature, I was specifying them with #resource in the source file. 

However, I managed to find a solution. I generated the mqproj file again and compared to the old version.  It seems that my old mqproj file became broken with the new MT5 releases.  Here's the pattern I found out:


The old version (broken now, was working before):

   "resources":
  [
    {
      "type":"indicator",
      "path":".\\EX5\\SampleIndicator.ex5",
      "name":"",
      "relative_to_project":"true"
    },

    ....
        
  ]     



New version:

   "resources":
  [
    {
      "type":"indicator",
      "path":".\\EX5\\SampleIndicator.ex5",
      "name":"EX5\\SampleIndicator.ex5",
      "relative_to_project":"true"
    },

    ....
        
  ]     


I updated all indicator entries in my old mqproj file and the issue seems to be gone.


Thanks

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Deal Properties
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Deal Properties
  • www.mql5.com
Deal Properties - Trade Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 

if I am not mistaken , place the indicator MQ5 file in the same folder where your main EA is placed, compile it after saving ( compile will generate an EX5 file),  use iCustom with no any suffix or prefix , just the name of the indicator  ,  handle_iCustom=iCustom(Symbol(), 0, "macd_Demo", 0); , 

https://www.mql5.com/en/docs/indicators/icustom

good luck

 
Unfortunately, this problem does not seem to have been solved even in 2022.
I want to save them in a resource so placing them in the same folder is not a fundamental solution.
Reason: