#resource

 
Good evening
Are there any limitations with #resource?

In an indicator
I have two resources

 #resource "\\Indicators\\Ressources\\Dev - Dev Team - Stochastic MTF.ex5" ;
 string                    g_Path_Stoc    = "::Indicators\\Ressources\\Dev - Dev Team - Stochastic MTF" ;

 #resource "\\Indicators\\Ressources\\Dev - Dev Team - Directed MA MTF.ex5" ;
 string                    g_Path_MA      = "::Indicators\\Ressources\\Dev - Dev Team - Directed MA MTF" ;


I have two icustom
  g_Hdl_Sto01 = iCustom ( _Symbol , gf_TFDef, g_Path_Stoc,
                         g_Sto_TF01, g_Sto_KPeriod01, g_Sto_DPeriod1, g_Sto_Signal01, g_Sto_SignalMeth01, g_Sto_SignalField01);
   if ( g_Hdl_Sto01 == INVALID_HANDLE ) {
    Error( StringFormat ( "%s: iCustom( Oscilator 01) failed" , __FUNCTION__ ));
     return INIT_FAILED ;
  }

  g_Hdl_MA01 = iCustom ( _Symbol , gf_TFDef, g_Path_MA,
                        g_Sto_TF01, g_Sto_TF01, 20 , 20 , MODE_SMA , MODE_EMA , PRICE_CLOSE , PRICE_CLOSE );
   if ( g_Hdl_MA01 == INVALID_HANDLE ) {
    Error( StringFormat ( "%s: iCustom( MA 01) failed" , __FUNCTION__ ));
     return INIT_FAILED ;
  }
The second icustom does not pass error 4002

What I find strange is that if I replace
 #resource "\\Indicators\\Ressources\\Dev - Dev Team - Directed MA MTF.ex5" ;
 string                    g_Path_MA      = "::Indicators\\Ressources\\Dev - Dev Team - Directed MA MTF" ;
by
 string                    g_Path_MA      = "Ressources/Dev - Dev Team - Directed MA MTF" ;

it works very well

I don't understand the 4002

Thx
 

Remember to always look up the meaning of the error code ...

ERR_WRONG_INTERNAL_PARAMETER

4002

Wrong parameter in the inner call of the client terminal function

This means that one or more of your parameters are incorrect for the custom indicator being called. It has nothing to do with any resource limitations.

 
Do you really think I didn't look at the definition of error before posting
 
Haven't you seen in my code explanations that in one version the icustom works very well with its list of parameters and that with another definition of the path to go through a resource putting it icustom with the same parameters so far from a 4002, doesn't work
 
It's exactly the same icustom. 

It seems to me that the paths to the ex5 in classic path and resource path must contain the error
 
Gerard William G J B M Dinh Sy #:
Haven't you seen in my code explanations that in one version the icustom works very well with its list of parameters and that with another definition of the path to go through a resource putting it icustom with the same parameters so far from a 4002, doesn't work

wow. i remember you posting a thread with same reported issue and I posted a response with a link in the forum, from years ago, that demonstrated, very clearly what you can and cannot do in that path.

I agree that "the paths to the ex5 in classic path and resource path" are clearly different, but that was already demonstrated in a couple threads, including the thread I have mentioned, but a couple others besides.

Either you follow the correct syntax rules, or you dont, right?

 
If you have a semblance of an explanation, I am willing to find a solution. 

I have QQ ideas for tests to do tomorrow to try to find an elegant solution
 
Gerard William G J B M Dinh Sy #:
If you have a semblance of an explanation, I am willing to find a solution. 

I have QQ ideas for tests to do tomorrow to try to find an elegant solution

If i remember correctly, we have to also deal with the spaces in filenames because when sourcing files outside the mql default folders, we deal with windows and the way it deals with files and filenames. The result is that it is never a good idea to have spaces in filenames if you want to source those files.

You could prove me wrong, however, I do remember in those same threads i mentioned, it was demonstrated by code and errors resulted with spaces in files, and no errors after removing those spaces in the filenames. This does not happen all the time, however, it often will create those errors.

EDIT: But I do not have a solution that you could use a single string in both lines of code. But, then, I do not see how it is an issue. It has always been like that. I will follow this thread, just in case that Fernando responds again, this time with something helpful :0
 
Thanks, I'll try that too.

Do you have the links to the threads you mention


 
Gerard William G J B M Dinh Sy #:
Thanks, I'll try that too.

Do you have the links to the threads you mention?



I think that this is the thread that both of us responded to. I added a further response with link to a russian link. just use browser translator when you get to the page.

https://www.mql5.com/en/forum/472069#comment_54881388

But there was a couple more similar threads in the forum. just search forum for resource.

In your EAs, where is the indicator code? - How to code indicators for EAs?
In your EAs, where is the indicator code? - How to code indicators for EAs?
  • 2024.08.27
  • Gerard William G J B M Dinh Sy
  • www.mql5.com
Apparently there are two ways to code indicators for eas. The first, put all the indicator code in the ea code. The second, put the indicator code in an indicator and call it via icustom i am clearly in favor of creating the indicators in an indicator and making an icustom for the ea
 

It is because of that thread that I started putting my custom include files in same folder as my ea. There have been a few updates of mt4/5 that reported to have fixed this issue, however that very same thread demonstrated that the previous updates had, in fact, NOT dealt with the issue fully. Therefore I started working as if the issue was(not) and still clearly is not -- fixed as yet.

For this same reason, I am continuing to not use custom folders as you showed in your code, so no /Indicators/blah -- but just /Indicators or /experts. and half the time i use "filename.mqh" whenever i can. Since I started doing this, I have avoided many scenarios that I would get errors in the past.

EDIT: But this slighly diverted from your thread issue. sorry.