/*
   Generated by EX4-TO-MQ4 decompiler V4.0.220.2 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Copyright © 2006, FX Sniper"
#property link      ""

#property indicator_separate_window
#property indicator_minimum 0.0
#property indicator_maximum 50.5
#property indicator_buffers 3
#property indicator_color1 Lime
#property indicator_color2 Yellow
#property indicator_color3 Red

double gda_76[];
double gda_80[];
double gda_84[];
double gda_88[];
double gda_92[];
double gda_96[];
extern int limit = 1000;
extern int BarSize = 2;
extern int trh = 10;

int init() {
   IndicatorBuffers(8);
   SetIndexBuffer(0, gda_84);
   SetIndexBuffer(1, gda_88);
   SetIndexBuffer(2, gda_92);
   SetIndexBuffer(3, gda_76);
   SetIndexBuffer(4, gda_80);
   SetIndexBuffer(5, gda_96);
   SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID, BarSize);
   SetIndexArrow(0, 167);
   SetIndexDrawBegin(0, limit - 40);
   SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, BarSize);
   SetIndexArrow(1, 167);
   SetIndexDrawBegin(1, limit - 40);
   SetIndexStyle(2, DRAW_ARROW, STYLE_SOLID, BarSize);
   SetIndexArrow(2, 167);
   SetIndexDrawBegin(2, limit - 40);
   SetIndexLabel(0, NULL);
   SetIndexLabel(1, NULL);
   SetIndexLabel(2, NULL);
   IndicatorShortName("SideWinder");
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   int li_32;
   double ld_36;
   double ld_44;
   double ld_56;
   double ld_64;
   int li_72;
   int li_76;
   bool li_80;
   double ld_88;
   double ld_96;
   double ld_104;
   int li_112;
   int li_116;
   bool li_120;
   double ld_124;
   double ld_132;
   double ld_140;
   int li_148;
   int li_0 = TimeDay(TimeCurrent());
   int li_4 = TimeMonth(TimeCurrent());
   int li_8 = TimeYear(TimeCurrent());
   if (li_0 >= 30 && li_4 >= 12 && li_8 >= 2006) {
      IndicatorShortName("Outdated Version: Contact fxsniper@gmail.com ");
      return;
   }
   int li_20 = 30;
   double ld_24 = 4.0 * MathArctan(1);
   for (int li_52 = limit - 26; li_52 >= 0; li_52--) {
      ld_44 = 0;
      for (int li_12 = 25; li_12 >= 1; li_12--) {
         ld_36 = 0;
         ld_36 = (li_12 - 8) * (Close[25 - li_12 + li_52]);
         ld_44 += ld_36;
      }
      gda_96[li_52] = 6.0 * ld_44 / 650.0;
   }
   for (int li_16 = limit; li_16 >= 0; li_16--) {
      gda_76[li_16] = iMA(NULL, 0, 34, 0, MODE_EMA, PRICE_CLOSE, li_16);
      gda_80[li_16] = gda_96[li_16];
   }
   for (li_12 = limit; li_12 >= 0; li_12--) {
      ld_56 = (Close[li_12 + 1] + (High[li_12 + 1]) + (Low[li_12 + 1])) / 3.0;
      ld_64 = 25 / (High[iHighest(NULL, 0, MODE_HIGH, li_20, li_12)] - Low[iLowest(NULL, 0, MODE_LOW, li_20, li_12)]) * Low[iLowest(NULL, 0, MODE_LOW, li_20, li_12)];
      li_72 = 0;
      li_76 = 1;
      li_80 = FALSE;
      ld_88 = (gda_76[li_12 + 1] - gda_76[li_12]) / ld_56 * ld_64;
      ld_96 = MathSqrt((li_76 - li_72) * (li_76 - li_72) + (ld_88 - li_80) * (ld_88 - li_80));
      ld_104 = MathRound(180.0 * MathArccos((li_76 - li_72) / ld_96) / ld_24);
      if (ld_88 > 0.0) ld_104 = -1.0 * ld_104;
      else ld_104 = ld_104;
      li_112 = 0;
      li_116 = 1;
      li_120 = FALSE;
      ld_124 = (gda_80[li_12 + 1] - gda_80[li_12]) / ld_56 * ld_64;
      ld_132 = MathSqrt((li_116 - li_112) * (li_116 - li_112) + (ld_124 - li_120) * (ld_124 - li_120));
      ld_140 = MathRound(180.0 * MathArccos((li_116 - li_112) / ld_132) / ld_24);
      if (ld_124 > 0.0) ld_140 = -1.0 * ld_140;
      else ld_140 = ld_140;
      if ((ld_104 < trh && ld_104 >= 0.0 && ld_140 + ld_104 >= trh) || (ld_140 < trh && ld_140 >= 0.0 && ld_140 + ld_104 >= trh)) li_32 = 1;
      else {
         if ((ld_104 > (-trh) && ld_104 <= 0.0 && ld_140 + ld_104 <= (-trh)) || (ld_140 > (-trh) && ld_140 <= 0.0 && ld_140 + ld_104 <= (-trh))) li_32 = 1;
         else {
            if (ld_104 <= (-trh) && ld_140 <= (-trh)) li_32 = 2;
            else {
               if (ld_104 >= trh && ld_140 >= trh) li_32 = 2;
               else li_32 = 0;
            }
         }
      }
      li_148 = 50;
      if (li_32 == 2) {
         gda_84[li_12] = li_148;
         gda_88[li_12] = EMPTY_VALUE;
         gda_92[li_12] = EMPTY_VALUE;
      }
      if (li_32 == 1) {
         gda_84[li_12] = EMPTY_VALUE;
         gda_88[li_12] = li_148;
         gda_92[li_12] = EMPTY_VALUE;
      }
      if (li_32 == 0) {
         gda_84[li_12] = EMPTY_VALUE;
         gda_88[li_12] = EMPTY_VALUE;
         gda_92[li_12] = li_148;
      }
   }
   return (0);
}
