
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red


double LongBuffer[];
double ShortBuffer[];


extern string _____________Set_Alert;
extern bool    Alert_On_off  =true; 
extern  int CloseAlert=      0;
extern bool    EnableAlertUp = false;
extern bool    EnableAlertDn = false;
extern bool    alertsSound   = false;
extern string  soundFileUp   = "alert.wav"; 
extern string  soundFileDn   = "alert2.wav"; 






//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

void init() 
{
   IndicatorBuffers(2);

   SetIndexBuffer(0,LongBuffer);
   SetIndexStyle(0,DRAW_ARROW,EMPTY,2);
   SetIndexArrow(0,233);
   SetIndexBuffer(1,ShortBuffer);
   SetIndexStyle(1,DRAW_ARROW,EMPTY,2);
   SetIndexArrow(1,234);
}

void deinit() 
{
   Comment("");
}

void start() 
{
  //-----
  
   int limit,i;
   int counted_bars=IndicatorCounted();
      
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-1-counted_bars;
   
   for(i=limit; i>=0; i--)
   {
      if(Close[i+6]<Open[i+6] &&
         Close[i+5]>Open[i+5] &&
         Close[i+4]>Open[i+4] &&
         Close[i+3]<Open[i+3] &&
         Close[i+2]>Open[i+2] &&
         Close[i+1]>Open[i+1])
         ShortBuffer[i]=High[i];
      else if(Close[i+6]>Open[i+6] &&
         Close[i+5]<Open[i+5] &&
         Close[i+4]<Open[i+4] &&
         Close[i+3]>Open[i+3] &&
         Close[i+2]<Open[i+2] &&
         Close[i+1]<Open[i+1])
         LongBuffer[i]=Low[i];
 
   }
   if(Alert_On_off){
      if(  ShortBuffer[CloseAlert]!=0 &&  ShortBuffer[CloseAlert]!=EMPTY_VALUE){
         static int lt1=0;
            if(lt1!=Time[0]){
               lt1=Time[0];
             if (EnableAlertDn)  Alert("Super -Signal ( "+Symbol()+","+(Period())+"):  DN ");
            if (alertsSound)   PlaySound(soundFileDn);
            }
      }
      if( LongBuffer[CloseAlert]!=0 &&  LongBuffer[CloseAlert]!=EMPTY_VALUE){
         static int lt2=0;
            if(lt2!=Time[0]){
               lt2=Time[0];
              
               if (EnableAlertUp)  Alert("Super -signal( "+Symbol()+","+(Period())+"):  UP ");
               if (alertsSound)    PlaySound(soundFileUp);
            }         
      }      
   }
   return(0);
}
