SuperSR8





//+------------------------------------------------------------------+
//|                SuperSR 8.mq4                                     |
//|                Copyright © 2006  Scorpion@fxfisherman.com        |
//+------------------------------------------------------------------+

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

extern int Contract_Step=50;
extern int Precision=1;
extern int Shift_Bars=1;
extern int Bars_Count= 1000;
int buy = 0, sell = 0;
//---- buffers
double v1[];
double v2[];
  
int init()
  {

   IndicatorBuffers(2);
  
   //SetIndexArrow(0, 159);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
   SetIndexDrawBegin(0,-1);
   SetIndexBuffer(0, v1);
   SetIndexLabel(0,"Resistance");
   
   //SetIndexArrow(1, 159); 
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
   SetIndexDrawBegin(1,-1);
   SetIndexBuffer(1, v2);
   SetIndexLabel(1,"Support");
 
   return(0);
  }

int start()
 {
 int m;
    m = Time[0] + Period()*60 - CurTime();
    m = (m - m % 60) / 60;
  double gap;
  double contract = (Contract_Step + Precision) * Point;
  int i;
  int shift; 
  bool fractal;
  double price;
  
  i = Bars_Count;
  
  while(i>=0)
   {
    shift = i + Shift_Bars;
    
    // Resistance
    price = High[shift+2];
    fractal = price >= High[shift+4] &&
              price >= High[shift+3] &&
              price > High[shift+1] &&
              price > High[shift];
              
    gap = v1[i+1] - price;
    if (fractal && (gap >= contract || gap < 0))
    {
      v1[i] = price + (Precision * Point);
    }else{
      v1[i] = v1[i+1];
    }

    // Support
    price = Low[shift+2];
    fractal = price <= Low[shift+4] &&
              price <= Low[shift+3] &&
              price < Low[shift+1] &&
              price < Low[shift];
              
    gap = price - v2[i+1];
    if (fractal && (gap >= contract || gap < 0))
    {
      v2[i] = price - (Precision * Point);
    }else{
      v2[i] = v2[i+1];
    }
    
    i--;
   }   
   
   if(buy == 0 && iLow(NULL,0,0) > v1[0] && m < 2){
   Alert("Buy " + Symbol());
   buy = 1;
   sell = 0;
   }
      if(sell == 0 && iHigh(NULL,0,0) < v2[0] && m < 2){
   Alert("Sell " + Symbol());
   buy = 0;
   sell = 1;
   }
   
  return(0);
 }
 
//+------------------------------------------------------------------+





Sample





Analysis



Market Information Used:

Series array that contains open time of each bar
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features:

It issuies visual alerts to the screen