//+------------------------------------------------------------------+
//|                                                    Color QQE.mq4 |
//|                                                     Godfreyh     |
//|                                                                  |
//+------------------------------------------------------------------+
#property link      ""
 
#property indicator_separate_window
#property indicator_buffers   4
#property indicator_level1   50
#property indicator_levelstyle STYLE_SOLID
#property indicator_levelcolor Red
#property indicator_color1 MidnightBlue
#property indicator_style1 STYLE_DOT
#property indicator_style2 STYLE_SOLID
#property indicator_color2 Blue
#property indicator_width2 2
#property indicator_color3 Lime
#property indicator_color4 Red
#property indicator_width3 2
#property indicator_width4 2
 
 
 
//---- input parameters
//
//    nice setings for trend = 35,10,1
//
//
 
extern string note1 = "QQE settings";
extern int       SF             =  5;
extern int       RSI_Period     =  14;
extern double    DARFACTOR      =  4.236;
extern string note5 = "0=high/low, 1=close/close";
//extern int       PriceField  =   1;
extern string note6 = "Buy level";
extern int       Buy  =  70;
extern string note7 = "Sell level";
extern int       Sell    =  30;
 
 
//---- buffers
//
//
//
//
//
 
double Solid[];
double Dotted[];
double Upper[];
double Lower[];
string DR;
double avg.rng, rng, sum.rng;
 
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
 
int init()
{
      SetIndexBuffer(0,Dotted);
      SetIndexBuffer(1,Solid);
      SetIndexBuffer(2,Upper);
      SetIndexBuffer(3,Lower);
      SetIndexLabel(1,"Fast");
      SetIndexLabel(2,NULL);
      SetIndexLabel(3,NULL);
         
         //
         //
         //
         //
         //
       
         //
         
   string shortName = "GH QQEA COLORED";
         if (Buy < Sell) Buy = Sell;
         if (Buy < 100)      shortName  = shortName+","+Buy;
         if (Sell   >   0)      shortName  = shortName+","+Sell;
   IndicatorShortName(shortName+")");
   return(0);
}
 
//
//
//
//
//
 
int deinit()
{
   return(0);
}
 
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
 
int start()
{
   int    counted_bars=IndicatorCounted();
   int    limit;
   int    i;
   
   
   
   
   if(counted_bars<0) return(-1);
   limit=Bars-counted_bars;
      
   //
   //
   //
   //
   //
   
   for(i=limit; i>=0; i--)
      {
            Solid[i]  = iCustom(NULL,0,"QQEA",SF,RSI_Period,DARFACTOR,0,i);
            Dotted[i] = iCustom(NULL,0,"QQEA",SF,RSI_Period,DARFACTOR,1,i);
 
            //
            //
            //
            //
            //
                                 
            if (Solid[i] > Buy) { Upper[i] = Solid[i]; Upper[i+1] = Solid[i+1]; }
            else                       { Upper[i] = EMPTY_VALUE;
                                         if (Upper[i+2] == EMPTY_VALUE)
                                             Upper[i+1]  = EMPTY_VALUE; }                            
            if (Solid[i] < Sell)   { Lower[i] = Solid[i]; Lower[i+1] = Solid[i+1]; }                   
            else                       { Lower[i] = EMPTY_VALUE;
                                         if (Lower[i+2] == EMPTY_VALUE)
                                             Lower[i+1]  = EMPTY_VALUE; }                            
      }
 
   //
   //
   //
   //
   //
   
   
   
   return(0);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
 

