//+------------------------------------------------------------------+
//|                                           VOLVOX_NOT_REPAINT.mq4 |
//|                                                   Copyright 2013 |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013"
#property link      ""

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red 
//--- buffers
double ExtMapBuffer1[];

#property indicator_level1  1.0
#property indicator_level2  -1.0
#property indicator_levelcolor Yellow
#property indicator_levelstyle 2

extern bool alert=true;
extern double Buy_Level=1.0, Sell_Level=1.0;
int Nbars = 21;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   for (int i=Bars - counted_bars -1 ;i>=0;i--)   
    {
      double a=iCustom(NULL, 0, "Volvox_Ver_7.0",0,i+1);
      ExtMapBuffer1[i]=iCustom(NULL, 0, "Volvox_Ver_7.0",0,i);
      
      if(alert==true && a > -Sell_Level && ExtMapBuffer1[i] == -Sell_Level)
      {Alert(Symbol()+"    Sell Signal  AT  "+Close[0]); }
      
      if(alert==true && a < Buy_Level && ExtMapBuffer1[i] == Buy_Level)
      {Alert(Symbol()+"    Buy Signal   AT  "+Close[0]); }
      
      Comment(a,"    ",ExtMapBuffer1[i]);
    }
   return(0);
  }
//+------------------------------------------------------------------+