/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Kalenzo"
#property link      "http://www.foreksik.prv.pl"

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

double g_ibuf_76[];
double g_ibuf_80[];
extern bool AlertsEnabled = TRUE;
extern double Step = 0.02;
extern double Maximum = 0.2;
extern int Precision = 7;
double g_bars_108;

int init() {
   SetIndexStyle(0, DRAW_ARROW, STYLE_DOT);
   SetIndexStyle(1, DRAW_ARROW, STYLE_DOT);
   SetIndexBuffer(0, g_ibuf_76);
   SetIndexBuffer(1, g_ibuf_80);
   SetIndexArrow(0, 108);
   SetIndexArrow(1, 108);
   IndicatorShortName("SAR COLORED");
   SetIndexLabel(0, "SAR Up Channel");
   SetIndexLabel(1, "SAR Down Channel");
   SetIndexDrawBegin(0, 2);
   SetIndexDrawBegin(1, 2);
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   double ld_12;
   int li_4 = IndicatorCounted();
   if (li_4 < 0) li_4 = 0;
   if (li_4 > 0) li_4--;
   int li_0 = Bars - li_4;
   for (int li_8 = 0; li_8 < li_0; li_8++) {
      ld_12 = NormalizeDouble(iSAR(Symbol(), 0, Step, Maximum, li_8), Precision);
      if (ld_12 >= iHigh(Symbol(), 0, li_8)) {
         if (AlertsEnabled == TRUE && g_ibuf_76[li_8] == 0.0 && Bars > g_bars_108) {
            Alert("Parabolic SAR Going Down on ", Symbol(), "-", Period());
            g_bars_108 = Bars;
         }
         g_ibuf_76[li_8] = ld_12;
         g_ibuf_80[li_8] = 0;
      } else {
         if (AlertsEnabled == TRUE && g_ibuf_80[li_8] == 0.0 && Bars > g_bars_108) {
            Alert("Parabolic SAR Channel Going Up on ", Symbol(), "-", Period());
            g_bars_108 = Bars;
         }
         g_ibuf_76[li_8] = 0;
         g_ibuf_80[li_8] = ld_12;
      }
   }
   return (0);
}
