Issue with custom indicator

 

I am new to MQL4 programming, and am trying to take lots of little steps to get acquainted with the syntax and different types of programs. I tried to program a simple moving average crossover indicator, but the lines drawn by the indicator do not have the same values for identical MA's created with the Moving Averages indicator that comes with MetaTrader 4. I am sure there is a simple solution for this, but any feedback is appreciated. Here is a copy of the code, preceded with a picture illustrating the issue. The arrow points to the custom indicator, which draws the blue and red moving averages. The lines above the blue and red are standard Moving Average indicators with a short EMA with P=50 and a long SMA with P=100:


Thanks for any help!



//+------------------------------------------------------------------+
//|                                                         MAs.mq4  |
//|                                                             Erik |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Erik"
#property link      ""

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 DarkBlue
//---- input parameters
extern int       Short=50;
extern int       Long=100;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   Alert("Indicator detached!");
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   for(int i=0; i < Bars; i++)
   {
      ExtMapBuffer1[i]=iMA(Symbol(),0,Short, 0, MODE_EMA, MODE_CLOSE, i);
      ExtMapBuffer2[i]=iMA(Symbol(),0,Long, 0, MODE_SMA, MODE_CLOSE,i);
   }
   
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
Reason: