/*
   G e n e r a t e d  by ex4-to-mq4 decompiler FREEWARE 4.0.509.5
   Website: h tT P: //W Ww . M eta q u oTe S . N e t
   E-mail : s u Pp oRT @ mET A Q UOtE s . NEt
*/
#property copyright "Copyright © 2013: MTH_Depok"
#property link      "do your homework mate..."

#property indicator_separate_window
#property indicator_minimum -25.0
#property indicator_maximum 125.0
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Lime
#property indicator_color3 HotPink

extern string ID = "1";
extern double Sign1Per = 5.0;
extern double Sign2Per = 34.0;
extern double Hival = 100.0;
extern double HMval = 90.0;
extern double Mdval = 50.0;
extern double LMval = 10.0;
extern double Loval = 0.0;
extern color HiLineColor = Fuchsia;
extern int HiLineStyle = 0;
extern int HiLineWidth = 0;
extern color HMLineColor = HotPink;
extern int HMLineStyle = 1;
extern int HMLineWidth = 0;
extern color MdLineColor = Yellow;
extern int MdLineStyle = 0;
extern int MdLineWidth = 2;
extern color LMLineColor = SpringGreen;
extern int LMLineStyle = 1;
extern int LMLineWidth = 0;
extern color LoLineColor = SeaGreen;
extern int LoLineStyle = 0;
extern int LoLineWidth = 0;
double G_ibuf_200[];
double G_ibuf_204[];
double G_ibuf_208[];
double G_ibuf_212[];
double Gd_216;
string Gs_224;

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   IndicatorBuffers(4);
   SetIndexBuffer(0, G_ibuf_200);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(1, G_ibuf_208);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexArrow(1, 159);
   SetIndexBuffer(2, G_ibuf_212);
   SetIndexStyle(2, DRAW_ARROW);
   SetIndexArrow(2, 159);
   SetIndexBuffer(3, G_ibuf_204);
   SetIndexEmptyValue(0, 0.0);
   SetIndexLabel(0, "Cyc_Line");
   SetIndexEmptyValue(1, 0.0);
   SetIndexLabel(1, "Up");
   SetIndexEmptyValue(2, 0.0);
   SetIndexLabel(2, "Down");
   Gs_224 = ID + "MTH DivCycOscillator(" + DoubleToStr(Sign1Per, 1) + "/" + DoubleToStr(Sign2Per, 1) + ")";
   IndicatorShortName(Gs_224);
   Gd_216 = 2.0 / (Sign1Per + 1.0);
   ObjectDelete(ID + "HiLine");
   ObjectCreate(ID + "HiLine", OBJ_HLINE, WindowFind(Gs_224), Time[0], NormalizeDouble(Hival, 1));
   ObjectSet(ID + "HiLine", OBJPROP_COLOR, HiLineColor);
   ObjectSet(ID + "HiLine", OBJPROP_STYLE, HiLineStyle);
   ObjectSet(ID + "HiLine", OBJPROP_WIDTH, HiLineWidth);
   ObjectSet(ID + "HiLine", OBJPROP_BACK, TRUE);
   ObjectDelete(ID + "HMLine");
   ObjectCreate(ID + "HMLine", OBJ_HLINE, WindowFind(Gs_224), Time[0], NormalizeDouble(HMval, 1));
   ObjectSet(ID + "HMLine", OBJPROP_COLOR, HMLineColor);
   ObjectSet(ID + "HMLine", OBJPROP_STYLE, HMLineStyle);
   ObjectSet(ID + "HMLine", OBJPROP_WIDTH, HMLineWidth);
   ObjectSet(ID + "HMLine", OBJPROP_BACK, TRUE);
   ObjectDelete(ID + "MdLine");
   ObjectCreate(ID + "MdLine", OBJ_HLINE, WindowFind(Gs_224), Time[0], NormalizeDouble(Mdval, 1));
   ObjectSet(ID + "MdLine", OBJPROP_COLOR, MdLineColor);
   ObjectSet(ID + "MdLine", OBJPROP_STYLE, MdLineStyle);
   ObjectSet(ID + "MdLine", OBJPROP_WIDTH, MdLineWidth);
   ObjectSet(ID + "MdLine", OBJPROP_BACK, TRUE);
   ObjectDelete(ID + "LMLine");
   ObjectCreate(ID + "LMLine", OBJ_HLINE, WindowFind(Gs_224), Time[0], NormalizeDouble(LMval, 1));
   ObjectSet(ID + "LMLine", OBJPROP_COLOR, LMLineColor);
   ObjectSet(ID + "LMLine", OBJPROP_STYLE, LMLineStyle);
   ObjectSet(ID + "LMLine", OBJPROP_WIDTH, LMLineWidth);
   ObjectSet(ID + "LMLine", OBJPROP_BACK, TRUE);
   ObjectDelete(ID + "LoLine");
   ObjectCreate(ID + "LoLine", OBJ_HLINE, WindowFind(Gs_224), Time[0], NormalizeDouble(Loval, 1));
   ObjectSet(ID + "LoLine", OBJPROP_COLOR, LoLineColor);
   ObjectSet(ID + "LoLine", OBJPROP_STYLE, LoLineStyle);
   ObjectSet(ID + "LoLine", OBJPROP_WIDTH, LoLineWidth);
   ObjectSet(ID + "LoLine", OBJPROP_BACK, TRUE);
   return (0);
}

// 52D46093050F38C27267BCE42543EF60
int deinit() {
   ObjectDelete(ID + "HiLine");
   ObjectDelete(ID + "HMLine");
   ObjectDelete(ID + "MdLine");
   ObjectDelete(ID + "LMLine");
   ObjectDelete(ID + "LoLine");
   return (0);
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   int Li_4;
   bool Li_12;
   double high_16;
   double low_24;
   double Ld_32;
   double Ld_40;
   double Ld_48;
   int ind_counted_8 = IndicatorCounted();
   if (ind_counted_8 == 0) Li_4 = Bars - Sign2Per;
   if (ind_counted_8 > 0) Li_4 = Bars - ind_counted_8;
   for (int Li_0 = Li_4; Li_0 >= 0; Li_0--) {
      high_16 = High[iHighest(NULL, 0, MODE_HIGH, Sign2Per, Li_0)];
      low_24 = Low[iLowest(NULL, 0, MODE_LOW, Sign2Per, Li_0)];
      Ld_32 = Close[Li_0] - low_24;
      Ld_40 = 100.0 * (Ld_32 / (high_16 - low_24));
      G_ibuf_204[Li_0] = Gd_216 * (Ld_40 - (G_ibuf_204[Li_0 + 1])) + (G_ibuf_204[Li_0 + 1]);
   }
   for (Li_0 = Li_4; Li_0 >= 0; Li_0--) {
      high_16 = G_ibuf_204[ArrayMaximum(G_ibuf_204, Sign2Per, Li_0)];
      low_24 = G_ibuf_204[ArrayMinimum(G_ibuf_204, Sign2Per, Li_0)];
      Ld_32 = G_ibuf_204[Li_0] - low_24;
      Ld_48 = 100.0 * (Ld_32 / (high_16 - low_24));
      G_ibuf_200[Li_0] = Gd_216 * (Ld_48 - (G_ibuf_200[Li_0 + 1])) + (G_ibuf_200[Li_0 + 1]);
   }
   for (Li_0 = Li_4; Li_0 >= 0; Li_0--) {
      Li_12 = FALSE;
      if (G_ibuf_200[Li_0] > G_ibuf_200[Li_0 + 1]) {
         G_ibuf_208[Li_0] = G_ibuf_200[Li_0];
         Li_12 = TRUE;
         G_ibuf_212[Li_0] = 0.0;
      }
      if (G_ibuf_200[Li_0] < G_ibuf_200[Li_0 + 1]) {
         G_ibuf_212[Li_0] = G_ibuf_200[Li_0];
         Li_12 = TRUE;
         G_ibuf_208[Li_0] = 0.0;
      }
      if (Li_12 == FALSE) {
         G_ibuf_208[Li_0] = G_ibuf_208[Li_0 + 1];
         G_ibuf_212[Li_0] = G_ibuf_212[Li_0 + 1];
      }
   }
   return (0);
}
