iCustom always returns empty value

 

Hi,

I made a simple custom indicator and I'm trying to use it in my EA. But there is a problem with loading values from indicator - iCustom always returns an empty value (tester, demo). When I show graph in EA tester, indicator is showed correct.

There is OnTick method from my EA:

void OnTick()
{
   static int SRStartArrowCounter = 0;
    
   double SR_Low = iCustom(NULL, PERIOD_M15, "SR_Levels", 5, 30, 0, 0);
   double SR_High = iCustom(NULL, PERIOD_M15, "SR_Levels", 5, 30, 1, 0);
   double SR_Low_length = iCustom(NULL, PERIOD_M15, "SR_Levels", 5, 30, 6, 0);
   double SR_High_length = iCustom(NULL, PERIOD_M15, "SR_Levels", 5, 30, 7, 0);
   
   Print("SR_Low="+SR_Low+", SR_High="+SR_High);
   Print("SR_Low_length="+SR_Low_length+", SR_High_length="+SR_High_length);
   
   if ((SR_Low_length==5 && SR_High_length>=5) || (SR_High_length==5 && SR_Low_length>=5))
   {
      SRStartArrowCounter++;
      ObjectCreate("SRStartArrowCounter"+SRStartArrowCounter, OBJ_ARROW, 0, Time[0], SR_Low);
   }
}

I attached a screen of my Metatrader and custom indicator.

Thanks for your answers and for your help.

Files:
SR_Levels.mq4  7 kb
screen.png  121 kb
 

Forum on trading, automated trading systems and testing trading strategies

Hello,

This forum is about MT5/mql5, please post your question about MT4/mql4 on mql4.com forum.

  • They are more people who can answer there.
  • They are more people who can have similar problem there.
  • A forum is not only to get help but to share with the community, mql4/MT4 community isn't the same as mql5/MT5 community.

 
angevoyageurHello, thanks for your answer.

I'm quite confused about versions. I'm using MetaTrader 4.00, but MetaEditor is in version 5.00 (last update). Because of MetaEditor version I've tried to post my question here.

I'll try to post it on mql4.com :) 


 
micky.2:

Please don't reply inside quote.

Yes, I know it's quite confusing, as there is a link to this forum in MetaEditor provide with MT4.

Reason: