title: Embedding a MQL4 custom indicator code in an Expert Advisor
body: <p>This is my first post on Stackoverflow although I've visited here for years.</p>
  
  <p>I have read the message guidelines so I'll be as succinct and specific as possible.</p>
  
  <blockquote>
    <p>I have been attempting to embed the code of a Custom Indicator directly in an Expert Advisor without having to call iCustom:</p>
  </blockquote>
  
  <pre><code>iCustom(Symbol(),60,"MB",3D,0,1)&gt;0;
  </code></pre>
  
  <p>Thus far I've failed and whilst I believe it is probably a trivial thing to do for many, if you don't know, you don't know.</p>
  
  <p>The iCustom code in question is the following and I'd be grateful for any assistance:</p>
  
  <pre><code>#property indicator_chart_window
  
  #property  indicator_buffers 2 
  #property  indicator_color1 Blue
  #property  indicator_color2 Red
  #property  indicator_width1 5
  #property  indicator_width2 5
  
  
  extern int 3D= 5
  
  
  double AIAIAI[];
  double B1B1B1[];
  
  //+------------------------------------------------------------------+
  //| Custom indicator initialization function                         |
  //+------------------------------------------------------------------+
  int init()
  {
     SetIndexBuffer( 0, AIAIAI );
     SetIndexEmptyValue( 0, 0.0 );
     SetIndexStyle( 0, DRAW_ARROW );
     SetIndexArrow( 0, 250 ); 
     SetIndexLabel( 0, NULL );
  
     SetIndexBuffer( 1, B1B1B1);
     SetIndexEmptyValue( 1, 0.0 );
     SetIndexStyle( 1, DRAW_ARROW );
     SetIndexArrow( 1, 250 ); 
     SetIndexLabel( 1, NULL ); 
  
     IndicatorDigits( 5 );
  
     //---- name for DataWindow and indicator subwindow label
     IndicatorShortName( MB(" + 3D+ ")" );
  
     return( 0 );
  }
  
  //+------------------------------------------------------------------+
  //| Custom indicator deinitialization function                       |
  //+------------------------------------------------------------------+
  int deinit()
  {
     return( 0 );
  }
  
  //+------------------------------------------------------------------+
  //| Custom indicator iteration function                              |
  //+------------------------------------------------------------------+
  int start()
  {
     int counted_bars = IndicatorCounted();
  
     if (counted_bars &lt; 0) return (-1);
     if (counted_bars &gt; 0) counted_bars--;
     int intLimit = Bars - counted_bars;
     int LO, HI;
  
     for( int NINI = intLimit; NINI &gt;= 0; NINI-- )
     {          
        AIAIAI[NINI] = 0.0;
        B1B1B1[NINI] = 0.0;
  
        LO = iLowest( Symbol(), Period(), MODE_LOW, 3D, NINI );
  
        if ( LO == NINI )
        {
           AIAIAI[NINI] = Low[NINI];
        }
  
        HI = iHighest( Symbol(), Period(), MODE_HIGH, 3D, NINI );
  
        if ( HI == NINI )
        {
           B1B1B1[NINI] = High[NINI];
        }
     }
  
     return( 0 );
  }
  </code></pre>
  
  <p>Thank you</p>