custom indicator added to expert advisor - so slow

forexalgotrading
54
forexalgotrading  

Hi there,

I've been looking at the adding the custom indicators as a resource to package up my Expert Advisor into 1 package. It all seems to work fine with one caveat... it's sooo slow. My Strategytester now runs a fraction of the speed compared to when I addressed the Indicator in the Indicators folder. There are no error messages and all seems to work otherwise. Am I missing something?

I presume this will also mean that there will be quite a noticeable lag with live trading. 

Has anyone seen this?

William Roeder
23727
William Roeder  

Be aware that using resources is 40x times slower than using CIs directly.
          A custom indicator as a resource - MQL4 programming forum 2019.11.26

forexalgotrading
54
forexalgotrading  
William Roeder:

Be aware that using resources is 40x times slower than using CIs directly.
          A custom indicator as a resource - MQL4 programming forum 2019.11.26

Hi WIlliam

Yes it is significantly slower.. is there any reason for this? Is this a bug or is there a workaround for this?

Do you know if this is the same for Metatrader 5?

Mehmet Bastem
2214
Mehmet Bastem  
forexalgotrading:

Hi there,

I've been looking at the adding the custom indicators as a resource to package up my Expert Advisor into 1 package. It all seems to work fine with one caveat... it's sooo slow. My Strategytester now runs a fraction of the speed compared to when I addressed the Indicator in the Indicators folder. There are no error messages and all seems to work otherwise. Am I missing something?

I presume this will also mean that there will be quite a noticeable lag with live trading. 

Has anyone seen this?

I am found a solution like this


 datetime prevtime
int SinyalKontrol()
  {

   if(Time[0] == prevtime)
      return(0);
   prevtime = Time[0];
   double Buy=iCustom(Symbol(),0,"HalfTrend MTF Clouds",1,1);
   double Sell=iCustom(Symbol(),0,"HalfTrend MTF Clouds",2,1);
   //... other code your...
   return(0);
  }