Wrote indicator call EA, it works,but returns EMPTY_VALUE

 

Hi, I am learning to code. Wrote this EA to call an indicator. It works fine. 

But, in 'Print' on a down trend, iCustom_1 returns an EMPTY_VALUE and on an up trend, iCustom_2 returns an EMPTY_VALUE. Could someone tell me what I've done wrong.

Thank you for the advice in advance.

Harvey_Trading

#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
    double iCUSTOM_1;
    double iCUSTOM_2;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
  
    
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
         iCUSTOM_1 = iCustom(NULL,0,"Super trend",0,0);
         iCUSTOM_2 = iCustom(NULL,0,"Super trend",1,0);
    
      if (iCUSTOM_1< iCUSTOM_2){
      Comment ("Trend Up");
      Print("iCUSTOM_1 is ",iCUSTOM_1);
      Print("iCUSTOM_2 is ",iCUSTOM_2);
      }
      if (iCUSTOM_1> iCUSTOM_2){
      Comment ("Trend Down");
      Print("iCUSTOM_1 is ",iCUSTOM_1);
      Print("iCUSTOM_2 is ",iCUSTOM_2);
      }

    
  }

 
Richard Roberts: But, in 'Print' on a down trend, iCustom_1 returns an EMPTY_VALUE and on an up trend, iCustom_2 returns an EMPTY_VALUE. Could someone tell me what I've done wrong.

Why do you think something is wrong?

Since you didn't post the indicator, we can only guess.

I guess that it draws one color on up trend and another on down trend. In MT4, only one color per buffer.

Reason: