
#property copyright ""
#property link      ""

#property indicator_separate_window
#property indicator_minimum -100.0
#property indicator_maximum 100.0
#property indicator_levelcolor Red
#property indicator_width1 2
#property indicator_level1 80.0
#property indicator_level2 -80.0
#property indicator_level3 0.0



extern color Color = Blue;
double g_ibuf_108[];
double g_ibuf_112[];
double g_ibuf_116[];
double gd_120;
//double gd_128;
//double gd_136;
//int gi_144 = 8;
int gi_148;
int gi_152;
extern int Ribbon_Per=48;
extern int Ribbon_Shift =0;
extern int Ribbon_Mode = 3;
/////////////////////////////////
extern int Cci_Per=6;
//////////////////////////////////
extern double Level_Cci=55.0;

int init() {
   IndicatorBuffers(3);
   SetIndexStyle(0, DRAW_LINE, EMPTY, 2, Color);
   SetIndexBuffer(0, g_ibuf_108);
   SetIndexBuffer(1, g_ibuf_116);
   SetIndexBuffer(2, g_ibuf_112);
   IndicatorShortName("Vostro Mahmoud 2");
   return (0);
}

int deinit() {
   return (0);
}

int start() {
  
   for (gi_152 = 0; gi_152 < Bars; gi_152++) {
     
     //////////////////////////////////////////////////////////////////////////////////
     // gd_128 = iMA(NULL, 0, Value_Per_Filter, 0, MODE_SMA, PRICE_CLOSE, gi_152);
      
    
     // gd_136 = 0.2 *iATR(NULL,0,Value_Per_Filter,gi_152);
      
      //////////////////////////////////////////////////////////////////////////////////
            
      g_ibuf_116[gi_152] = iCCI(NULL,0,Cci_Per,PRICE_LOW,gi_152);//(Low[gi_152] - gd_128) / gd_136;
      g_ibuf_112[gi_152] = iCCI(NULL,0,Cci_Per,PRICE_HIGH,gi_152);//(High[gi_152] - gd_128) / gd_136;
      
      ////////////////////////////////////////////////////////////////////////////////////////////
      
      if (g_ibuf_112[gi_152] > Level_Cci && Close[gi_152] > iMA(NULL, 0, Ribbon_Per, Ribbon_Shift, Ribbon_Mode, PRICE_HIGH, gi_152)) g_ibuf_108[gi_152] = 90.0;
      else {
         if (g_ibuf_116[gi_152] < -Level_Cci && Close[gi_152] < iMA(NULL, 0,Ribbon_Per, Ribbon_Shift, Ribbon_Mode, PRICE_LOW, gi_152)) g_ibuf_108[gi_152] = -90.0;
         else g_ibuf_108[gi_152] = 0.0;
      }
      
   }
   return (0);
}