Download MetaTrader 5

calling custom indicator inside bot/ea through resources that has nested custom indicator

To add comments, please log in or register
Need mobile version of MetaTrader 5? Download it and trade!
Michael Sarikas
3423
Michael Sarikas 2014.09.12 06:46 

Say we have a few custom indicators in the bot/EA:

#resource "\\Indicators\\indi1.ex4"

#resource "\\Indicators\\indi2.ex4"

#resource "\\Indicators\\indi3.ex4" (has a resource to indi4.ex4) i.e. 2 level nested

#resource "\\Indicators\\indi4.ex4"  

 All these custom indicators work by themselves in the terminal but crash (cannot load) when they are combined as resources to be used inside the bot/EA, specifically indi3.ex4 indi4.ex4.

iCustom(Symbol(),Period,"::Indicators\\indi4.ex4",param1,0,0);

iCustom(Symbol(),Period,"indi3.ex4::Indicators\\indi4.ex4",param1,0,0,0,0); 

iCustom(Symbol(),Period,"\\Indicators\\indi3.ex4::Indicators\\indi4.ex4",param1,0,0,0,0);

iCustom(Symbol(),Period,"\\Experts\\autobot.ex4::Indicators\\indi4.ex4",param1,0,0,0,0); 

I want to use all these indicators independent of each other in bot, but there is conflict between indi3 & indi4, is my guess.

What would be the correct calling code for iCustom()?

Alain Verleyen
Moderator
30711
Alain Verleyen 2014.09.12 11:00  
skeezwiz:

Say we have a few custom indicators in the bot/EA:

#resource "\\Indicators\\indi1.ex4"

#resource "\\Indicators\\indi2.ex4"

#resource "\\Indicators\\indi3.ex4" (has a resource to indi4.ex4) i.e. 2 level nested

#resource "\\Indicators\\indi4.ex4"  

 All these custom indicators work by themselves in the terminal but crash (cannot load) when they are combined as resources to be used inside the bot/EA, specifically indi3.ex4 indi4.ex4.

iCustom(Symbol(),Period,"::Indicators\\indi4.ex4",param1,0,0);

iCustom(Symbol(),Period,"indi3.ex4::Indicators\\indi4.ex4",param1,0,0,0,0); 

iCustom(Symbol(),Period,"\\Indicators\\indi3.ex4::Indicators\\indi4.ex4",param1,0,0,0,0);

iCustom(Symbol(),Period,"\\Experts\\autobot.ex4::Indicators\\indi4.ex4",param1,0,0,0,0); 

I want to use all these indicators independent of each other in bot, but there is conflict between indi3 & indi4, is my guess.

What would be the correct calling code for iCustom()?

#resource "\\Indicators\\indi4.ex4"

iCustom(Symbol(),Period,"::Indicators\\indi4.ex4",param1,0,0);

In both indi3 and your EA.

Michael Sarikas
3423
Michael Sarikas 2014.09.12 12:30  
angevoyageur:

In both indi3 and your EA.

tried this syntax already and not work.
Stanislav Korotky
17870
Stanislav Korotky 2014.09.12 12:33  
skeezwiz:
tried this syntax already and not work.
Until recently, MT4 did not support nesting of resources. I wrote a task ( #1046703 ) into the service desk. The task is closed now as fixed (at 2014.07.29), so you should check if you have latest version.
Alain Verleyen
Moderator
30711
Alain Verleyen 2014.09.12 12:44  
skeezwiz:
tried this syntax already and not work.
What is not working, please be more explicit. Show the relevant code, show your logs.
Michael Sarikas
3423
Michael Sarikas 2014.09.12 13:24  
angevoyageur:
What is not working, please be more explicit. Show the relevant code, show your logs.

04:52:47 cannot load resource 'C:\Users\Administrator\AppData\Roaming\MetaQuotes\Terminal\GUID\MQL4\Libraries\::Indicators\indi4.ex4::Indicators\indi4.ex4'

04:52:47 Cannot load 'C:\Users\Administrator\AppData\Roaming\MetaQuotes\Terminal\GUID\MQL4\Libraries\::Indicators\indi4.ex4::Indicators\indi4.ex4'

Alain Verleyen
Moderator
30711
Alain Verleyen 2014.09.12 14:04  
skeezwiz:

04:52:47 cannot load resource 'C:\Users\Administrator\AppData\Roaming\MetaQuotes\Terminal\GUID\MQL4\Libraries\::Indicators\indi4.ex4::Indicators\indi4.ex4'

04:52:47 Cannot load 'C:\Users\Administrator\AppData\Roaming\MetaQuotes\Terminal\GUID\MQL4\Libraries\::Indicators\indi4.ex4::Indicators\indi4.ex4'

Please how the relevant code, as already asked. In which directory are your source(s) code ?

Obviously you are confused about your "path".

Michael Sarikas
3423
Michael Sarikas 2014.09.12 14:40  
angevoyageur:

Please how the relevant code, as already asked. In which directory are your source(s) code ?

Obviously you are confused about your "path".

its not the location of the folder the .ex4 files are in the correct places, any other guesses?

Again the code as above is throwing cannot load resource as soon as the bot is attached to a chart. It compiles correctly.

Michael Sarikas
3423
Michael Sarikas 2014.09.12 14:40  
marketeer:
Until recently, MT4 did not support nesting of resources. I wrote a task ( #1046703 ) into the service desk. The task is closed now as fixed (at 2014.07.29), so you should check if you have latest version.
which version of mt4 are you using?
Stanislav Korotky
17870
Stanislav Korotky 2014.09.12 17:48  
skeezwiz:
which version of mt4 are you using?

My version is still outdated, and I made a workaround for this problem by extracting core part of my "middle" indicator into a library, which I included into my expert. So the nesting level of indicators became = 1, which works.

I asked in the service desk what is the version where the fix is committed, but I did not get response, alas.

Arturo Lopez Perez
161451
Arturo Lopez Perez 2015.06.16 11:52  

I understand this post is very old, but I face the same problem.

//---- resource
#resource "\\Indicators\\Heiken_Ashi_Smoothed.ex4"

/**
* Checks direction of Heiken Ashi Smoothed
* @return   int
*/
int GetHeikenAshiTrend(int shift)
{
   double open  = iCustom(Symbol(), 0, "::Indicators\\Heiken_Ashi_Smoothed.ex4", MaMetod, MaPeriod, MaMetod2, MaPeriod2, 4, shift);
   double close = iCustom(Symbol(), 0, "::Indicators\\Heiken_Ashi_Smoothed.ex4", MaMetod, MaPeriod, MaMetod2, MaPeriod2, 5, shift);
   if(close > open) return(OP_BUY);
   return(OP_SELL);
}

Works in the tester, but when dragged to a chart...

Any idea why?

Thanks

12
To add comments, please log in or register