Problem with calling specific indicators from resources

 

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:

#resource "\\Indicators\\AbsoluteStrength_v2.ex5" 
#resource "\\Indicators\\AbsoluteStrengthMarket_v1.ex5"
#resource "\\Indicators\\Swing line.ex5"
#resource "\\Indicators\\Turbo_JRSX__2.ex5"

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)

   tjHandle = iCustom(Symbol(), 0, "::Indicators\\Turbo_JRSX__2", tj_Len1, tj_Len2, 95, 1);
   swHandle = iCustom(Symbol(), 0, "::Indicators\\Swing line");
   asHandle = iCustom(Symbol(), 0, "::Indicators\\AbsoluteStrength_v2", ..................);
   as1Handle = iCustom(Symbol(), 0, "::Indicators\\AbsoluteStrengthMarket_v1", .....................);
 
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]


What makes you think that an Indicator is considered to be a Resource ?
 
RaptorUK:
What makes you think that an Indicator is considered to be a Resource ?

Your moderator team.

When I tried to post the EA in the market without putting them into resources, Alexx told me:

Alexx 2013.09.26 11:29

Hello,

You need to include the required indicators as resources to the EA.

Use #resource "<path_to_resource_file>" to include indicators and "::Indicators\<path>" to call the indicators in the code.


So thats what I did.

 
Klammeraffe:

Your moderator team.

When I tried to post the EA in the market without putting them into resources, Alexx told me:

Alexx 2013.09.26 11:29

Hello,

You need to include the required indicators as resources to the EA.

Use #resource "<path_to_resource_file>" to include indicators and "::Indicators\<path>" to call the indicators in the code.


So thats what I did.

You didn't ask why ?  if your Indicator is in the Indicator folder why do you need to do this ?  perhaps it is a UAC issue . . .
 
RaptorUK:
  perhaps it is a UAC issue . . .
Did you check if the Indicators exist in the Virtual Store ?
 
RaptorUK:
You didn't ask why ?  if your Indicator is in the Indicator folder why do you need to do this ?  perhaps it is a UAC issue . . .

I knew why. Because to be in the market, I could not tell people to download specific indicators, put it in the folder there and there, do that and that.

When people download the EA from the market with their MetaTrader Client, it has to work right away, even with the indicators not being downloaded by them.

So, Alexx told me to put them into resources, because otherwise I could not publish the EA in the market.


So, now I have 2 indicators that work fine with resources, and 2 that don't. And I have no clue, why.

 
RaptorUK:
Did you check if the Indicators exist in the Virtual Store ?

How do I do that?

All 4 indicators get compiled successfully into the ex5. 

I checked that.

All my files are in appdata/roaming folder for all my metatrader installations. So there shouldnt be a problem with UAC. Especially not, that 2 indicators work and 2 don't, even though all 4 got compiled.

Of course, I tested the EA in a fresh installation, where none of the indicators is installed in. 


Also, thank you for your help and time so far.

 
Klammeraffe:

Your moderator team.

When I tried to post the EA in the market without putting them into resources, Alexx told me:

Alexx 2013.09.26 11:29

Hello,

You need to include the required indicators as resources to the EA.

Use #resource "<path_to_resource_file>" to include indicators and "::Indicators\<path>" to call the indicators in the code.


So thats what I did.

I think the best thing to do is to post a reply to Alexx and ask him some help.

asHandle = iCustom(Symbol(), 0, "::Indicators\\AbsoluteStrength_v2", ..................);

Did you test the handle and print error n° ?

   if(asHandle==INVALID_HANDLE)
      Print("Handle invalid for ... error= ", GetLastError());
 
Klammeraffe:

I knew why. Because to be in the market, I could not tell people to download specific indicators, put it in the folder there and there, do that and that.

When people download the EA from the market with their MetaTrader Client, it has to work right away, even with the indicators not being downloaded by them.

So, Alexx told me to put them into resources, because otherwise I could not publish the EA in the market.

Ah OK,  I now understand. 
 
angevoyageur:

Did you test the handle and print error n° ?

This is what I get:

2013.09.27 11:53:23    Core 1    program file Indicators\AbsoluteStrength_v2.ex5 read error
2013.09.27 11:53:23    Core 1    loading of AbsoluteStrengthMarket_v1 USDJPY,H1 failed
2013.09.27 11:53:23    Core 1    2013.01.01 00:00:00   cannot load custom indicator 'AbsoluteStrengthMarket_v1' [4802]


4802 is wrong handle isn't it?

But still it loads the other one and it works if I just put them in the folder by myself.

Step on New Rails: Custom Indicators in MQL5
Step on New Rails: Custom Indicators in MQL5
  • 2009.11.23
  • Андрей
  • www.mql5.com
I will not list all of the new possibilities and features of the new terminal and language. They are numerous, and some novelties are worth the discussion in a separate article. Also there is no code here, written with object-oriented programming, it is a too serous topic to be simply mentioned in a context as additional advantages for developers. In this article we will consider the indicators, their structure, drawing, types and their programming details, as compared to MQL4. I hope that this article will be useful both for beginners and experienced developers, maybe some of them will find something new.
 
Klammeraffe:

This is what I get:

2013.09.27 11:53:23    Core 1    program file Indicators\AbsoluteStrength_v2.ex5 read error
2013.09.27 11:53:23    Core 1    loading of AbsoluteStrengthMarket_v1 USDJPY,H1 failed
2013.09.27 11:53:23    Core 1    2013.01.01 00:00:00   cannot load custom indicator 'AbsoluteStrengthMarket_v1' [4802]


4802 is wrong handle isn't it?

But still it loads the other one and it works if I just put them in the folder by myself.

If you are sure that "AbsoluteStrengthMarket_v1" and "AbsoluteStrength_v2" really exists in the right folder (C:\Users\XXX\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Indicators), then there is maybe a MT5/mql5 bug. Ask for help to alexx as suggested, or write to ServiceDesk. And please let us informed.