//+------------------------------------------------------------------+
//|                                             super-signals_v2.mq4 |
//|                Copyright © 2006, Nick Bilak, beluck[AT]gmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Nick Bilak"
#property copyright "alterations by Mark Tomlinson"
#property link      "http://www.forex-tsd.com/"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Yellow
#property indicator_width1 5
#property indicator_width2 5
//input properties
extern int  dist2           = 59;// was 21 250
extern int  dist1           = 59;// was 14
extern bool alertsOn        = true;
extern bool alertsOnCurrent = true;
extern bool alertsMessage   = true;
extern bool alertsSound     = true;
extern bool alertsEmail     = false;
double alertBar;
extern int SignalGap=3;
double b1[];
double b2[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexBuffer(0,b1);
   SetIndexBuffer(1,b2);
   SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,222);
   SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,221);
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int i,hhb1,llb1;
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
   if(counted_bars==0) limit-=1+MathMax(dist1,dist2);
   for(i=limit;i>=0;i--)
     {
      hhb1 = Highest(NULL,Period(),MODE_HIGH,dist2,i-dist2/2);
      llb1 = Lowest(NULL,Period(),MODE_LOW,dist1,i-dist2/2);
      b1[i] = EMPTY_VALUE;
      b2[i] = EMPTY_VALUE;
      double tr=iATR(NULL,0,5,i);
      if(i==hhb1)   b1[i]=High[hhb1] + tr/2;
      if(i==llb1)  b2[i]=Low[llb1] -tr/2;
      if(i == 0 && b1[i]!=0 && b2[i] != 2147483647 && Bars>alertBar) {Alert("Super_Signal UP Alert " + Symbol() + " on the " +  Period() + " minute chart ");alertBar = Bars;}
      if(i == 0 && b2[i]!=0 && b1[i] != 2147483647 && Bars>alertBar) {Alert("Super_Signal DOWN Alert " + Symbol() + " on the " +  Period() + " minute chart ");alertBar = Bars;}
     }
   return(0);
  }
//+------------------------------------------------------------------+
            
Comments