#property copyright "Don Isbell"
#property link      "disbellj@gmail.com"
//----
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 DeepSkyBlue
#property indicator_color2 Red
#property indicator_color3 White

#property indicator_width1 3
#property indicator_width2 3
#property indicator_width3 3

extern string KosMAnote1 = "20 LWMA is Current TF HAS";
extern string KosMAnote2 = "Divide TTF by STF to get Multiplier";
extern string KosMAnote3 = "Multiplier x 20 to get TTF MA period";
extern string note_MA_Method = "0=SMA,1=EMA,2=SMMA,3=LWMA";
extern string note1_MA_Price = "0=CLOSE,1=OPEN,2=HIGH,3=LOW";
extern string note2_MA_Price = "4=MEDIAN,5=TYPICAL,6=WEIGHTED";
extern bool UseMA1 = True;
extern int MA1period = 20;
extern int MA1method = 3;
extern int MA1price = 6; 
extern bool UseMA2 = True;
extern int MA2period = 300;
extern int MA2method = 3;
extern int MA2price = 6;
extern bool UseMA3 = True;
extern int MA3period = 1200;
extern int MA3method = 3;
extern int MA3price = 6;

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//|------------------------------------------------------------------|
int init()
  {
//---- indicators
   IndicatorBuffers(3);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0, ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2, ExtMapBuffer3);
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
	int limit;
	int counted_bars=IndicatorCounted();
  	//---- check for possible errors
	if(counted_bars<0) return(-1);
  	//---- the last counted bar will be recounted
  	if(counted_bars>0) counted_bars--;
 	limit=Bars-counted_bars;
  	//---- main loop
  	for(int i=0; i<limit; i++) {
  		//---- ma_shift set to 0 because SetIndexShift called above
		if(UseMA1 == True) ExtMapBuffer1[i]=iMA(NULL,0,MA1period,0,MA1method,MA1price,i);
   	if(UseMA2 == True) ExtMapBuffer2[i]=iMA(NULL,0,MA2period,0,MA2method,MA2price,i);
    	if(UseMA3 == True) ExtMapBuffer3[i]=iMA(NULL,0,MA3period,0,MA3method,MA3price,i);
	}

  //---- done
   return(0);
  }
//+------------------------------------------------------------------+