
#property copyright "Copyright © 2009, Anne Boleyn, PhD"
#property link      "http://xxx"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Yellow
#property indicator_color3 Blue
#property indicator_color4 Green

extern int Wingding1 = 108;
extern int Wingding2 = 108;
extern int Wingding3 = 108;
extern int Wingding4 = 108;
extern int ATR = 5;
extern int PipsOffset = 3;
bool gi_100 = FALSE;
double g_ibuf_104[];
double g_ibuf_108[];
double g_ibuf_112[];
double g_ibuf_116[];
int g_minute_120 = 0;

int init() {
   SetIndexBuffer(0, g_ibuf_104);
   SetIndexArrow(0, Wingding1);
   SetIndexStyle(0, DRAW_ARROW, EMPTY);
   SetIndexBuffer(1, g_ibuf_108);
   SetIndexArrow(1, Wingding2);
   SetIndexStyle(1, DRAW_ARROW, EMPTY);
   SetIndexBuffer(2, g_ibuf_112);
   SetIndexArrow(2, Wingding3);
   SetIndexStyle(2, DRAW_ARROW, EMPTY);
   SetIndexBuffer(3, g_ibuf_116);
   SetIndexArrow(3, Wingding4);
   SetIndexStyle(3, DRAW_ARROW, EMPTY);
   return (0);
}

int deinit() {
   Comment("");
   return (0);
}

int start() {
   double l_open_12;
   double l_high_20;
   double l_low_28;
   double l_close_36;
   double l_open_44;
   double l_high_52;
   double l_low_60;
   double l_close_68;
   double l_iatr_4 = iATR(NULL, 0, ATR, 0);
   Comment(ATR, " bar ATR is ", DoubleToStr(l_iatr_4 / Point, 1), " pips");
   for (int l_index_0 = 0; l_index_0 < Bars; l_index_0++) {
      l_open_12 = Open[l_index_0];
      l_high_20 = High[l_index_0];
      l_low_28 = Low[l_index_0];
      l_close_36 = Close[l_index_0];
      l_open_44 = Open[l_index_0 + 1];
      l_high_52 = High[l_index_0 + 1];
      l_low_60 = Low[l_index_0 + 1];
      l_close_68 = Close[l_index_0 + 1];
      if (l_high_20 < l_high_52 && l_low_28 > l_low_60 && MathMax(l_open_12, l_close_36) < MathMax(l_open_44, l_close_68) && MathMin(l_open_12, l_close_36) > MathMin(l_open_44, l_close_68)) {
         g_ibuf_112[l_index_0] = High[l_index_0] + l_iatr_4;
         if (gi_100 && g_minute_120 != Minute()) {
            PlaySound("alert.wav");
            g_minute_120 = Minute();
         }
      }
   }
   return (0);
}