Problem with calling specific indicators from resources - page 3

 
Klammeraffe:

Hi,

I get annoying problems with 2 indicators out of 4 used in my EA.

Whatever I do, the EA fails to load them, even though they get compiled successfully into resources and the other 2 indicators work fine.

They only work when I put the files into the indicator folder, which gives me the impression that they don't get called from resources. However, the other 2 indicators do.

Both absolute strength indicators create this error:

2013.09.27 11:00:18    Tester    expert file C:\Users\XXX\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Indicators\AbsoluteStrengthMarket_v1.ex5 open error [2]

2013.09.27 11:00:18    Tester    expert file C:\Users\XXX\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Indicators\AbsoluteStrength_v2.ex5 open error [2]


Can someone help me?


This is how I create the resource:

This is the call into iCustom for handle:

(Note, I also tried "::Indicators\\AbsoluteStrength_v2.ex5" and "::Indicators\AbsoluteStrength_v2", because I got confused due to the error" but nothing works)

Hi Klammeraffe,

Try something like this:

#property tester_indicator "your indicator"

I had to make this on my EA in order to get them working correctly.

I hope it will help you.

 

R. 

Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
Documentation on MQL5: Language Basics / Preprocessor / Program Properties (#property)
  • www.mql5.com
Language Basics / Preprocessor / Program Properties (#property) - Documentation on MQL5
 
remulix:

Hi Klammeraffe,

Try something like this:

#property tester_indicator "your indicator"

I had to make this on my EA in order to get them working correctly.

I hope it will help you.

 

R. 

This can't be the solution. #property tester_indicator is needed for testing with Strategy Tester in some circumstances. But here the issue is that the EA compiled with resources don't even load on a chart.
 

Hi,

Alexx found the solution to the problem.

It was not caused by the EA but by the used indicators. Both absolute strength indicators called themselve via iCustom function.

The call of course asked for the file in the installation/roaming directory of the terminal by default.

So basically, I needed to tell the indicator to take the file out of the EAs resources.

Original:

   if(TimeFrame > 0) mtf_handle = iCustom(Symbol(),TimeFrame,"AbsoluteStrength_v2",0,MathMode,Price,Length,PreSmooth,Smooth,
                Signal,MA_Mode,LevelsMode,StrengthLevel,WeaknessLevel,LookBackPeriod,UpperMultiplier,LowerMultiplier);

Then Alexx gave me this function to automatically check for the right path:

string GetRelativeProgramPath()
  {
//--- get absolute path to application
   string path=MQL5InfoString(MQL5_PROGRAM_PATH);
//--- find the position of substring "\MQL5\"
   int    pos =StringFind(path,"\\MQL5\\");
//--- error - substring not found
   if(pos<0)
      return(NULL);
//--- skip folder "\MQL5"
   pos+=5;
//--- skip unnecessary '\'
   while(StringGetCharacter(path,pos+1)=='\\')
      pos++;
//--- return path relative to the main folder MQL5
   return(StringSubstr(path,pos));
  }
 

And this needed to be called in OnInit:

   string IndPath=GetRelativeProgramPath();
   if(TimeFrame > 0) mtf_handle = iCustom(Symbol(),TimeFrame,IndPath,0,MathMode,Price,Length,PreSmooth,Smooth,
                Signal,MA_Mode,LevelsMode,StrengthLevel,WeaknessLevel,LookBackPeriod,UpperMultiplier,LowerMultiplier);
   
 
Klammeraffe:

And this needed to be called in OnInit:

Thank you for the feedback.
 
Thank you your posts helped me a lot with resource i was even having same problem but now solved thanks a lot keep it up cheers.
 
Georg Frieske:

Hi,

Alexx found the solution to the problem.

It was not caused by the EA but by the used indicators. Both absolute strength indicators called themselve via iCustom function.

The call of course asked for the file in the installation/roaming directory of the terminal by default.

So basically, I needed to tell the indicator to take the file out of the EAs resources.

Original:

Then Alexx gave me this function to automatically check for the right path:

hello georg,

i am facing the same issue in mql4 i tried to modify the function for mql4 but getting error and not able to use it properly can you help

(i know i am replying 2013 post but i need help anyone? )

 
  1. Don't resurrect old threads without a very good reason. A lot has changed since Build 600 and Higher. 2014.02.03

  2. Don't Hijack other threads for your off-topic post. Next time, make your own, new, thread.

  3. Open the «Data Folder»\Indicators and make sure the executable is there
              Data Structure in MetaTrader 4 Build 600 and Higher - MQL4 Articles 2014.02.03

  4. Asad Sheikh: i tried to modify the function for mql4  but getting error 
    1. Do or do not, there is no try.

    2. An error is meaningless. "Doesn't work" is meaningless — just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires — meaningless.
           How To Ask Questions The Smart Way. 2004
                When asking about code

    3. Always post all relevant code.
           How To Ask Questions The Smart Way. 2004
                Be precise and informative about your problem

      We can't see your broken code.

      Fix your broken code.

      With the information you've provided — we can only guess. And you haven't provided any useful information for that.

Reason: