iCustom problem mql4

 

Hello and sorry for bother if there is already same problem.

I am trying to call from my EA indicator via iCustom()

Indicator code is that

#property indicator_separate_window

#property indicator_buffers  7
#property  indicator_color1  Yellow
#property  indicator_color3  Aqua
#property  indicator_color4  Aqua
#property  indicator_color5  Lime
#property  indicator_color6  Red
#property indicator_color7 Blue

#property  indicator_width1  3
//----+

//----+
extern int TimeFrame = 30; 
extern int RSI=5;
extern int applied_RSI=0; 
extern int MA=50;
extern int method_MA=0; 
extern int koridor = 5;
//---- buffers
double BU0[];
double BU1[];
double BU2[];
double BU3[];
double BU4[];
double BU5[];

extern int CCI_Period = 30;
extern int T3_Period = 30;
extern double b = 0.618;
//----
double e1, e2, e3, e4, e5, e6;
double c1, c2, c3, c4;
double n, w1, w2, b2, b3;
double cci[];
double cciHup[];
double cciHdn[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorShortName("TARZAN "+RSI+"/"+MA);
   SetIndexBuffer(0, BU0);
   SetIndexStyle(0, DRAW_LINE);   
   SetIndexBuffer(1, BU1);
   SetIndexStyle(1,DRAW_NONE);
   //---- 
   SetIndexBuffer(2, BU2);
   SetIndexStyle(2, DRAW_LINE);   
   SetIndexBuffer(3, BU3);
   SetIndexStyle(3,DRAW_LINE);
   //----
   SetIndexBuffer(4, BU4);
   SetIndexStyle(4, DRAW_ARROW);
   SetIndexArrow(4,110);
   
   SetIndexBuffer(5, BU5);
   SetIndexStyle(5,DRAW_ARROW);
   SetIndexArrow(5,110);      
//----

    return(0);
  }

int start()
  {
  
//----
   int limit,b_sh;  
   int counted_bars=IndicatorCounted();   
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//----
Print(limit + "limit");
for(int i=0; i<limit; i++)
   {
    b_sh=iBarShift(Symbol(),TimeFrame,Time[i]);            
    BU0[i] = iRSI(Symbol(),TimeFrame,RSI,applied_RSI,i); 
     }

   int koef = 1;
   if(TimeFrame>0)koef = TimeFrame/Period();
//----
   for(i=0; i<limit; i++)
    {           
     BU1[i] = iMAOnArray(BU0,0,MA*koef,0,method_MA,i);
     BU2[i] = iMAOnArray(BU0,0,MA*koef,0,method_MA,i)+koridor;
     BU3[i] = iMAOnArray(BU0,0,MA*koef,0,method_MA,i)-koridor;         
    }        
//----
   for(i=0; i<limit; i++){
    if(BU0[i]>BU1[i]) 
    BU4[i]= iMAOnArray(BU0,0,MA*koef,0,method_MA,i);
    else BU5[i]= iMAOnArray(BU0,0,MA*koef,0,method_MA,i);          
   }

   return(0);
  }

in EA I am trying to use iCustom to get access to data from this indicator

double BU0 = iCustom(NULL, 0, "TARZAN",16, 0, 0);

double BU1 = iCustom(NULL, 0, "TARZAN", 16, 1, 0);


But values are of both are 0. I think I am doing something pitty but wiuld be anyone so king and tell me where is a problem? Or how to properly load indicators to EA.

Thank you very much,

Jiri Honomichl

 
thralik: I am trying to call from my EA indicator via iCustom()
  1. Either it's an EA or it's an indicator - no such thing as an "EA indicator"
  2. Detailed explanation of iCustom - MQL4 forum How many externals does your indictor have? Your iCustom only passes one.
    double BU0 = iCustom(NULL, 0, "TARZAN",16, 0, 0);
 
Thrank you for the link, everything working now, thank you very much ;-)