 
// #4X 2010 SSL Color         \¦/
// Knowledge of the ancients (ò ó)
//______________________o0o___(_)___o0o_____
//___¦Xard777¦_____¦_____¦_____¦_____¦_2010_¦

#property indicator_chart_window
#property indicator_buffers 6

#property indicator_color1 CLR_NONE//White
#property indicator_color2 CLR_NONE//Yellow
#property indicator_color3 CLR_NONE//Aqua

#property indicator_width1 2
#property indicator_width2 6
#property indicator_width3 6

#property indicator_color4 White
#property indicator_color5 Yellow
#property indicator_color6 SpringGreen

#property indicator_width4 2
#property indicator_width5 4
#property indicator_width6 4


extern int Lb = 9;
double ssla[],sslb[],sslc[],Hld,Hlv;

extern int Lb2 = 6;
double ssla2[],sslb2[],sslc2[],Hld2,Hlv2;
//+------------------------------------------------------------------+

int init()
  {
//---- indicators
   IndicatorBuffers(6);

   SetIndexBuffer(0,sslc);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexArrow(0, 159);
   
   SetIndexBuffer(1,ssla);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexArrow(1, 159);

   SetIndexBuffer(2,sslb);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexArrow(2, 159);
//-----   
      SetIndexBuffer(3,sslc2);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexArrow(3, 159);
   
   SetIndexBuffer(4,ssla2);
   SetIndexStyle(4,DRAW_LINE);
   SetIndexArrow(4, 159);

   SetIndexBuffer(5,sslb2);
   SetIndexStyle(5,DRAW_LINE);
   SetIndexArrow(5, 159);
//----
   return(0);
  }
//+------------------------------------------------------------------+

int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

int start()
  {
//----
   for(int i=Bars-Lb;i>=0;i--)
   {
      if(Close[i]>iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1)) Hld = 1;
      else 
      {
       if(Close[i]<iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1)) Hld = -1;
       else
       Hld = 0;
      }
      
      if(Hld!=0)
      Hlv = Hld;
            
      if(Hlv == -1){
         sslc[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1);
         ssla[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1);
      }else{
         sslc[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1);
         sslb[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1);
      }
   }
   
//----

   //----
   for(int x=Bars-Lb2;x>=0;x--)
   {
      if(Close[x]>iMA(Symbol(),0,Lb2,0,MODE_SMA,PRICE_HIGH,x+1)) Hld2 = 1;
      else 
      {
       if(Close[x]<iMA(Symbol(),0,Lb2,0,MODE_SMA,PRICE_LOW,x+1)) Hld2 = -1;
       else
       Hld2 = 0;
      }
      
      if(Hld2!=0)
      Hlv2 = Hld2;
            
      if(Hlv2 == -1){
         sslc2[x] = iMA(Symbol(),0,Lb2,0,MODE_SMA,PRICE_HIGH,x+1);
         ssla2[x] = iMA(Symbol(),0,Lb2,0,MODE_SMA,PRICE_HIGH,x+1);
      }else{
         sslc2[x] = iMA(Symbol(),0,Lb2,0,MODE_SMA,PRICE_LOW,x+1);
         sslb2[x] = iMA(Symbol(),0,Lb2,0,MODE_SMA,PRICE_LOW,x+1);
      }
   }

   return(0);
  }
//+------------------------------------------------------------------+