//+------------------------------------------------------------------+
//|                                             guppy selectable.mq4 |
//|                                                            ....h |
//|                                                  ibfx forum crew |
//+------------------------------------------------------------------+
#property copyright "....h"
#property link      "ibfx forum crew"


#property indicator_chart_window
#property indicator_buffers 8

extern string select_0_for_defaults = "1=2-16, 2=18-32, 3=36-50, 4=52-66";
extern int select        =    1;
extern int method        =    1;
extern int appliedprice  =    0;


extern int periods1      =   10;
extern int periods2      =   20;
extern int periods3      =   30;
extern int periods4      =   40;
extern int periods5      =   50;
extern int periods6      =   60;
extern int periods7      =   70;
extern int periods8      =   80;

double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];
double ExtMapBuffer8[];




int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,EMPTY,2,Blue);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE,EMPTY,1,Lime);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE,EMPTY,1,Lime);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_LINE,EMPTY,1,Lime);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(4,DRAW_LINE,EMPTY,1,Lime);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexStyle(5,DRAW_LINE,EMPTY,1,Lime);
   SetIndexBuffer(5,ExtMapBuffer6);
   SetIndexStyle(6,DRAW_LINE,EMPTY,1,Lime);
   SetIndexBuffer(6,ExtMapBuffer7);
   SetIndexStyle(7,DRAW_LINE,EMPTY,2,Red);
   SetIndexBuffer(7,ExtMapBuffer8);
   
   
   return(0);
  }

int deinit()
  {
   return(0);
  }

int start()
  {
   int i,j,limit,counted_bars=IndicatorCounted();
   
   
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   
   for(i=0; i<limit; i++){
       if (select==1) {periods1 =  2; periods2 =  4; periods3 =  6; periods4 =  8;
                       periods5 = 10; periods6 = 12; periods7 = 14; periods8 = 16; }
                       
       if (select==2) {periods1 = 18; periods2 = 20; periods3 = 22; periods4 = 24;
                       periods5 = 26; periods6 = 28; periods7 = 30; periods8 = 32; }
                       
       if (select==3) {periods1 = 34; periods2 = 36; periods3 = 38; periods4 = 40;
                       periods5 = 42; periods6 = 44; periods7 = 46; periods8 = 48; }
                       
       if (select==4) {periods1 = 50; periods2 = 52; periods3 = 54; periods4 = 56;
                       periods5 = 58; periods6 = 60; periods7 = 62; periods8 = 64; }  
                                    
       if (select==5) {periods1 = 66; periods2 = 68; periods3 = 70; periods4 = 72;
                       periods5 = 74; periods6 = 76; periods7 = 78; periods8 = 80; }
                                            
       if (select==6) {periods1 = 82; periods2 = 84; periods3 = 86; periods4 = 88;
                       periods5 = 90; periods6 = 92; periods7 = 94; periods8 = 96; }                    
   
      ExtMapBuffer1[i]=iMA(NULL,0,periods1,0,method,appliedprice,i);
      ExtMapBuffer2[i]=iMA(NULL,0,periods2,0,method,appliedprice,i);
      ExtMapBuffer3[i]=iMA(NULL,0,periods3,0,method,appliedprice,i);
      ExtMapBuffer4[i]=iMA(NULL,0,periods4,0,method,appliedprice,i);
      ExtMapBuffer5[i]=iMA(NULL,0,periods5,0,method,appliedprice,i);
      ExtMapBuffer6[i]=iMA(NULL,0,periods6,0,method,appliedprice,i);
      ExtMapBuffer7[i]=iMA(NULL,0,periods7,0,method,appliedprice,i);
      ExtMapBuffer8[i]=iMA(NULL,0,periods8,0,method,appliedprice,i);
      
   }
   return(0);
   }
//+------------------------------------------------------------------+