//ScalperSignal_v1.01
#property copyright "Copyright © 2007, NiX @ www.forex-tsd.com"
#property link      "http://www.forex-tsd.com"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 White
#property indicator_color2 White
#property indicator_color3 LightGreen
#property indicator_color4 Red
extern int CountBars = 300;
extern string FS = " ** Filter sensitivity: High <-[1..4]-> Low ** ";
extern int Sensitivity = 2;//2
extern int bar = 3;//3
double bufer1[];
double bufer2[];
double bufer3[];
double bufer4[];
int init() {
   IndicatorBuffers(4);
   SetIndexStyle(2, DRAW_ARROW);
   SetIndexArrow(2, 233);
   SetIndexBuffer(2, bufer1);
   SetIndexStyle(3, DRAW_ARROW);
   SetIndexArrow(3, 234);
   SetIndexBuffer(3, bufer2);
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 3, White);
   SetIndexBuffer(0, bufer3);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 3, White);
   SetIndexBuffer(1, bufer4);
   SetIndexEmptyValue(0, 0);
   SetIndexEmptyValue(1, 0);
   SetIndexEmptyValue(2, 0);
   SetIndexEmptyValue(3, 0);
   SetIndexLabel(2, "Buy Signal");
   SetIndexLabel(3, "Sell Signal");
   SetIndexLabel(0, "High");
   SetIndexLabel(1, "Low");
   SetIndexEmptyValue(0, EMPTY_VALUE);
   SetIndexEmptyValue(1, EMPTY_VALUE);
   SetIndexEmptyValue(2, EMPTY_VALUE);
   SetIndexEmptyValue(3, EMPTY_VALUE);
   string Name = "Scalper Signal";
   IndicatorShortName(Name);
   if (Sensitivity < 1) Sensitivity = 1;
   if (Sensitivity > 3) Sensitivity = 3;
   return (0);
}
int deinit() {
   return (0);
}
double sellSignal(int shift) {
   bool limit = TRUE;
   if (Sensitivity > 3)
      if (iHigh(Symbol(), Period(), shift + 7) >= iHigh(Symbol(), Period(), shift + 6)) limit = FALSE;
   if (Sensitivity > 2)
      if (iHigh(Symbol(), Period(), shift + 6) >= iHigh(Symbol(), Period(), shift + 5)) limit = FALSE;
   if (Sensitivity > 1)
      if (iHigh(Symbol(), Period(), shift + 5) >= iHigh(Symbol(), Period(), shift + 4)) limit = FALSE;
   if (Sensitivity > 0)
      if (iHigh(Symbol(), Period(), shift + 4) >= iHigh(Symbol(), Period(), shift + 3)) limit = FALSE;
   if (limit) {
      if (iClose(Symbol(), Period(), shift + 2) < iHigh(Symbol(), Period(), shift + 3))
      if (iClose(Symbol(), Period(), shift + 1) < iLow(Symbol(), Period(), shift + 3)) return (iLow(Symbol(), Period(), shift + 3) - 10.0 * Point);
   }
   return (0);
}
double buySignal(int shift) {
   bool limit = TRUE;
   if (Sensitivity > 3)
      if (iLow(Symbol(), Period(), shift + 7) <= iLow(Symbol(), Period(), shift + 6)) limit = FALSE;
   if (Sensitivity > 2)
      if (iLow(Symbol(), Period(), shift + 6) <= iLow(Symbol(), Period(), shift + 5)) limit = FALSE;
   if (Sensitivity > 1)
      if (iLow(Symbol(), Period(), shift + 5) <= iLow(Symbol(), Period(), shift + 4)) limit = FALSE;
   if (Sensitivity > 0)
      if (iLow(Symbol(), Period(), shift + 4) <= iLow(Symbol(), Period(), shift + 3)) limit = FALSE;
   if (limit) {
      if (iClose(Symbol(), Period(), shift + 2) > iLow(Symbol(), Period(), shift + 3))
      if (iClose(Symbol(), Period(), shift + 1) > iHigh(Symbol(), Period(), shift + 3)) return (iHigh(Symbol(), Period(), shift + 3) + 10.0 * Point);
   }
   return (0);
}
int start() {
   int counted_bars = IndicatorCounted();
   if (counted_bars < 0) return (-1);
   if (counted_bars > 0) counted_bars--;
   int limit = Bars - counted_bars;
   for (int i = 0; i < limit; i++) {
      bufer1[i + bar] = buySignal(i);
      bufer2[i + bar] = sellSignal(i);
      if (buySignal(i) > 0.0 || sellSignal(i) > 0.0) {
         bufer3[i + bar] = iHigh(Symbol(), Period(), i + bar);
         bufer4[i + bar] = iLow(Symbol(), Period(), i + bar);
      }
   }
return (0);}
             
            
            
            
Comments