Navigation´╝ÜHome > Content >

ACSignal.mq4

Time: 2016-11-06 | Download file:ACSignal.mq4

//+------------------------------------------------------------------+
//|                     AC Alert                                     |
//|                                                                  |
//|                   [email protected]                             |
//+------------------------------------------------------------------+

/*
  +------------------------------------------------------------------+
  | Accelerator Oscillator Signals                                   |
  +------------------------------------------------------------------+
*/   
#property copyright "[email protected])"
#property link      "Accelerator Oscillator"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red

double CrossUp[];
double CrossDown[];
extern bool SignalMail = False;
extern bool SoundAlert = true;

int Current;

 
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators


   SetIndexStyle(0, DRAW_ARROW, EMPTY);
   SetIndexArrow(0, 233);
   SetIndexBuffer(0, CrossUp);
  
   
  SetIndexStyle(1, DRAW_ARROW, EMPTY);
  SetIndexArrow(1, 234);
  SetIndexBuffer(1, CrossDown);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
   int limit, i, counter;
   
   
   double ACCurrent, ACPrevious;
  

 
   double Range, AvgRange;
   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-counted_bars;
   
   for(i = 0; i <= limit; i++) {
   
      counter=i;
      Range=0;
      AvgRange=0;
      for (counter=i ;counter<=i+9;counter++)
     {
         AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
      }
    Range=AvgRange/10;
       
  
   
    ACCurrent = iAC(NULL, 0, Current + i);
    ACPrevious = iAC(NULL, 0, Current + i+1);     
    
    
      
      if ( ACCurrent>0 && ACPrevious<0 ) {
           CrossUp[i] = Low[i] - Range*0.4;
         
      if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " AC Primary Buy");  
      if (SoundAlert) Alert("[Signal Alert]", "[" + Symbol() + "] " + " AC Primary Buy");   
         

      }
      else if ( ACCurrent<0 && ACPrevious>0 ) {
               CrossDown[i] = High[i] + Range*0.4;
         
      if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " AC Primary Sell");  
      if (SoundAlert) Alert("[Signal Alert]", "[" + Symbol() + "] " + " AC Primary Sell");   
         

      }
   }
   return(0);
}

Recommend