I'm trying to add indicator as resources. Many indicators had added without any problem but some indicator shows following error.
I'm assuming this is happends because "SampleIndicator" call itself as
iCustom(0,0,"SampleIndicator.ex4",........)
Is there any way to solve this error. Thank You for your time.
#resource "\\Indicators\\TRIX.ex4"
void OnTick()
{
.../...
valueTRIX= iCustom(simb, timeFrame, "::Indicators\\TRIX.ex4", periodCalc, priceWork, nBuff, nBar);
.../...
}
#resource "\\Indicators\\TRIX.ex4"
void OnTick()
{
.../...
valueTRIX= iCustom(simb, timeFrame, "::Indicators\\TRIX.ex4", periodCalc, priceWork, nBuff, nBar);
.../...
}
Thank you very much for your time. I have already done that(didn't solve) but I also found the solution. This might helpful to anyone in future.
Problem indeed was from indicator calling itself from indicator by this:
indicatorFileName = WindowExpertName();
///....
//+------------------------------------------------------------------+
//| GetRelativeProgramPath |
//+------------------------------------------------------------------+
string GetRelativeProgramPath()
{
int pos2;
//--- get the absolute path to the application
string path=MQLInfoString(MQL_PROGRAM_PATH);
//--- find the position of "\MQL4\" substring
int pos =StringFind(path,"\\MQL4\\");
//--- substring not found - error
if(pos<0)
return(NULL);
//--- skip "\MQL4" directory
pos+=5;
//--- skip extra '\' symbols
while(StringGetCharacter(path,pos+1)=='\\')
pos++;
//--- if this is a resource, return the path relative to MQL5 directory
if(StringFind(path,"::",pos)>=0)
return(StringSubstr(path,pos));
//--- find a separator for the first MQL4 subdirectory (for example, MQL4\Indicators)
//--- if not found, return the path relative to MQL4 directory
if((pos2=StringFind(path,"\\",pos+1))<0)
return(StringSubstr(path,pos));
//--- return the path relative to the subdirectory (for example, MQL4\Indicators)
return(StringSubstr(path,pos2+1));
}
Thank you very much for your time. I have already done that(didn't solve) but I also found the solution. This might helpful to anyone in future.
Problem indeed was from indicator calling itself from indicator by this:
indicatorFileName = WindowExpertName();
it really helped in the future...
thanks :)
Thank you very much for your time. I have already done that(didn't solve) but I also found the solution. This might helpful to anyone in future.
Hello in relation to this how should I write the Indicator file name. That is the format
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm trying to add indicator as resources. Many indicators had added without any problem but some indicator shows following error.
cannot load '......\MQL4\Experts\SampleExpert.ex4::Indicators\SampleIndicator.ex4::Indicators\SampleIndicator.ex4'
I'm assuming this is happends because "SampleIndicator" call itself as
iCustom(0,0,"SampleIndicator.ex4",........)
Is there any way to solve this error. Thank You for your time.