Discussion of article "Use of Resources in MQL5" - page 4

 

Hello,

in the article it is mentioned "...an Expert Advisor can use the resources that are located in an indicator or EX5 library".

Is it possible to use functions from a library file when having embedded it as a resource?

 
Jan Flodin:

Hello,

in the article it is mentioned "...an Expert Advisor can use the resources that are located in an indicator or EX5 library".

Is it possible to use functions from a library file when having embedded it as a resource?

Not possible. Unfortunately.

 

Please help me. I can't understand this situation.

There is a simple indicator and an Expert Advisor that calls it. Both are located in the folder of shared projects "Shared Projects\Testing\Indicator\".

I connect the indicator to the Expert Advisor as a resource. And I want to create a handle using the resource.

Here is a block of code:

//--- resource
#resource "Indicator.ex5";
//+------------------------------------------------------------------+
//| Expert initialisation function|
//+------------------------------------------------------------------+
int OnInit()
  {
   string path=GetRelativeProgramPath();
   path=path+"::Indicator.ex5"; 
//--- indicator
   int ha=iCustom(_Symbol,_Period,path);
   if(ha==INVALID_HANDLE)
      return INIT_FAILED;
//---
   return INIT_SUCCEEDED;
  }

The compilation is successful, so the indicator as a resource is attached.

As a result, the path to the indicator is as follows: Shared Projects\Testing\Indicator\TestingEA.ex5::Indicator.ex5. Everything seems to be correct. The compiled indicator file is there in the folder.

The GetRelativeProgramPath() function is an example from the article.

No matter how I twist it, I can't create a handle. Thank you.

Files: