//+------------------------------------------------------------------+
//|                                                                  |
//|                                                                  |
//|                   Moving Average Shadowed.mq4                    |
//|                                                                  |
//|                                                                  | 
//+------------------------------------------------------------------+ 

#property  copyright "TRO_Tunnel_dragon, Copyright © 2008"
//  Avery T. Horton, Jr. aka TRO, PO BOX 43575, TUCSON, AZ 85733,
//  therumpledone@gmail.com " 

/*--------------------------------------------------------------------
Moving Average Shadowed:

This indicator uses core coding of the copyright indicator above.  The
indicator will draw two of the moving average line.  One line can be a
a wide line of a color that highlights the moving average line display.
The second line should be of single line width of one of the varied
styles, or of more than single line width, so long as it is not as wide 
as the highligthing line.
                                                        - traderathome
---------------------------------------------------------------------*/  

#property indicator_chart_window 

#property indicator_buffers  3
#property indicator_color1   Yellow 
#property indicator_color2   Black
#property indicator_color3   CLR_NONE
#property indicator_width1   4
#property indicator_width2   1
#property indicator_width3   1
#property indicator_style1   STYLE_SOLID
#property indicator_style2   STYLE_DASHDOTDOT
#property indicator_style3   STYLE_SOLID

// indicators parameters
extern bool    Indicator_On? = true;
extern int     MAPeriod      = 89;
extern string  MATypeNote    = "0=SMA,1=EMA,2=SMMA,3=LWMA";
extern int     MAType        = 1;
extern string  MAPriceNote1  = "0=CLOSE,1=OPEN,2=HIGH,3=LOW";
extern string  MAPriceNote2  = "4=MEDIAN,5=PP,6=WEIGHT";
extern int     MAPrice       = 0;

//---- buffers & variables
double P1Buffer[];
double P2Buffer[];
int   myPeriod        = 0 ;
int   myShift         = 0 ;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- name for indicator window
   string short_name=" ";
   IndicatorShortName(short_name);
 
   SetIndexBuffer(0, P1Buffer);
   SetIndexBuffer(1, P2Buffer);
 
//----
   SetIndexStyle(0, DRAW_LINE);   
   SetIndexStyle(1, DRAW_LINE);

// setting the indicator values, which will be invisible on the chart
   SetIndexEmptyValue(0,0);
   SetIndexEmptyValue(1,0); 
   
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {       
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   if (Indicator_On? == false){return(0);}
   datetime TimeArray[];
   int i, dayi, counted_bars = IndicatorCounted();
//---- check for possible errors
   if(counted_bars < 0) 
       return(-1);
//---- last counted bar will be recounted
   if(counted_bars > 0) 
       counted_bars--;  
   int limit = Bars - counted_bars;
//----   
   for(i = limit - 1; i >= 0; i--)   //---- Tricolor indicator code 
     {
     int BarShift = iBarShift(NULL,myPeriod,Time[i+myShift],true);         
     //P0Buffer[i] = iMA(NULL,myPeriod, MA_Period1,0,MAType1,MAPrice1,BarShift);       
     P1Buffer[i] = iMA(NULL,myPeriod,MAPeriod,0,MAType,MAPrice,BarShift); 
     P2Buffer[i] = iMA(NULL,myPeriod,MAPeriod,0,MAType,MAPrice,BarShift);       
     }	 
  	
   return(0);
}
//----------------------End Program------------------------------------