/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/

#property indicator_chart_window

extern bool Daily = TRUE;
extern bool Weekly = FALSE;
extern bool Monthly = FALSE;
double gd_88;
double gd_96;
double gd_104;
double gda_112[][6];
double g_price_116;
double g_price_124;
double g_price_132;
double g_price_140;
double g_price_148;
double g_price_156;
double g_price_164;
double gd_172;
double gd_180;
double gd_188;
double gda_196[][6];
double g_price_200;
double g_price_208;
double g_price_216;
double g_price_224;
double g_price_232;
double g_price_240;
double g_price_248;
double gd_256;
double gd_264;
double gd_272;
double gda_280[][6];
double g_price_284;
double g_price_292;
double g_price_300;
double g_price_308;
double g_price_316;
double g_price_324;
double g_price_332;

int init() {
   return (0);
}

int deinit() {
   ObjectDelete("PivotLine");
   ObjectDelete("R1_Line");
   ObjectDelete("R2_Line");
   ObjectDelete("R3_Line");
   ObjectDelete("S1_Line");
   ObjectDelete("S2_Line");
   ObjectDelete("S3_Line");
   ObjectDelete("PivotLabel");
   ObjectDelete("R1_Label");
   ObjectDelete("R2_Label");
   ObjectDelete("R3_Label");
   ObjectDelete("S1_Label");
   ObjectDelete("S2_Label");
   ObjectDelete("S3_Label");
   ObjectDelete("WeekPivotLine");
   ObjectDelete("WR1_Line");
   ObjectDelete("WR2_Line");
   ObjectDelete("WR3_Line");
   ObjectDelete("WS1_Line");
   ObjectDelete("WS2_Line");
   ObjectDelete("WS3_Line");
   ObjectDelete("WeekPivotLabel");
   ObjectDelete("WR1_Label");
   ObjectDelete("WR2_Label");
   ObjectDelete("WR3_Label");
   ObjectDelete("WS1_Label");
   ObjectDelete("WS2_Label");
   ObjectDelete("WS3_Label");
   ObjectDelete("MonthPivotLine");
   ObjectDelete("MR1_Line");
   ObjectDelete("MR2_Line");
   ObjectDelete("MR3_Line");
   ObjectDelete("MS1_Line");
   ObjectDelete("MS2_Line");
   ObjectDelete("MS3_Line");
   ObjectDelete("MonthPivotLabel");
   ObjectDelete("MR1_Label");
   ObjectDelete("MR2_Label");
   ObjectDelete("MR3_Label");
   ObjectDelete("MS1_Label");
   ObjectDelete("MS2_Label");
   ObjectDelete("MS3_Label");
   return (0);
}

int start() {
   ArrayInitialize(gda_112, 0);
   ArrayCopyRates(gda_112, Symbol(), PERIOD_D1);
   gd_88 = gda_112[1][3];
   gd_96 = gda_112[1][2];
   gd_104 = gda_112[1][4];
   g_price_116 = (gd_88 + gd_96 + gd_104) / 3.0;
   g_price_148 = 2.0 * g_price_116 - gd_96;
   g_price_124 = 2.0 * g_price_116 - gd_88;
   g_price_156 = g_price_116 + (g_price_148 - g_price_124);
   g_price_132 = g_price_116 - (g_price_148 - g_price_124);
   g_price_140 = gd_96 - 2.0 * (gd_88 - g_price_116);
   g_price_164 = gd_88 + 2.0 * (g_price_116 - gd_96);
   ArrayInitialize(gda_196, 0);
   ArrayCopyRates(gda_196, Symbol(), PERIOD_W1);
   gd_172 = gda_196[1][3];
   gd_180 = gda_196[1][2];
   gd_188 = gda_196[1][4];
   g_price_200 = (gd_172 + gd_180 + gd_188) / 3.0;
   g_price_232 = 2.0 * g_price_200 - gd_180;
   g_price_208 = 2.0 * g_price_200 - gd_172;
   g_price_240 = g_price_200 + (g_price_232 - g_price_208);
   g_price_216 = g_price_200 - (g_price_232 - g_price_208);
   g_price_224 = gd_180 - 2.0 * (gd_172 - g_price_200);
   g_price_248 = gd_172 + 2.0 * (g_price_200 - gd_180);
   ArrayInitialize(gda_280, 0);
   ArrayCopyRates(gda_280, Symbol(), PERIOD_MN1);
   gd_256 = gda_280[1][3];
   gd_264 = gda_280[1][2];
   gd_272 = gda_280[1][4];
   g_price_284 = (gd_256 + gd_264 + gd_272) / 3.0;
   g_price_316 = 2.0 * g_price_284 - gd_264;
   g_price_292 = 2.0 * g_price_284 - gd_256;
   g_price_324 = g_price_284 + (g_price_316 - g_price_292);
   g_price_300 = g_price_284 - (g_price_316 - g_price_292);
   g_price_308 = gd_264 - 2.0 * (gd_256 - g_price_284);
   g_price_332 = gd_256 + 2.0 * (g_price_284 - gd_264);
   if (Daily == TRUE) {
      ObjectCreate("PivotLine", OBJ_HLINE, 0, TimeCurrent(), g_price_116);
      ObjectSet("PivotLine", OBJPROP_COLOR, Fuchsia);
      ObjectSet("PivotLine", OBJPROP_STYLE, STYLE_DASH);
      if (ObjectFind("PivotLabel") != 0) {
         ObjectCreate("PivotLabel", OBJ_TEXT, 0, Time[20], g_price_116);
         ObjectSetText("PivotLabel", "Daily Pivot", 8, "Arial", Fuchsia);
      } else ObjectMove("PivotLabel", 0, Time[20], g_price_116);
      ObjectCreate("R1_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_148);
      ObjectSet("R1_Line", OBJPROP_COLOR, LightSlateGray);
      ObjectSet("R1_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("R1_Label") != 0) {
         ObjectCreate("R1_Label", OBJ_TEXT, 0, Time[20], g_price_148);
         ObjectSetText("R1_Label", "Daily R1", 8, "Arial", Red);
      } else ObjectMove("R1_Label", 0, Time[20], g_price_148);
      ObjectCreate("R2_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_156);
      ObjectSet("R2_Line", OBJPROP_COLOR, LightSlateGray);
      ObjectSet("R2_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("R2_Label") != 0) {
         ObjectCreate("R2_Label", OBJ_TEXT, 0, Time[20], g_price_156);
         ObjectSetText("R2_Label", "Daily R2", 8, "Arial", Red);
      } else ObjectMove("R2_Label", 0, Time[20], g_price_156);
      ObjectCreate("R3_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_164);
      ObjectSet("R3_Line", OBJPROP_COLOR, LightSlateGray);
      ObjectSet("R3_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("R3_Label") != 0) {
         ObjectCreate("R3_Label", OBJ_TEXT, 0, Time[20], g_price_164);
         ObjectSetText("R3_Label", "Daily R3", 8, "Arial", Red);
      } else ObjectMove("R3_Label", 0, Time[20], g_price_164);
      ObjectCreate("S1_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_124);
      ObjectSet("S1_Line", OBJPROP_COLOR, LightSlateGray);
      ObjectSet("S1_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("S1_Label") != 0) {
         ObjectCreate("S1_Label", OBJ_TEXT, 0, Time[20], g_price_124);
         ObjectSetText("S1_Label", "Daily S1", 8, "Arial", LimeGreen);
      } else ObjectMove("S1_Label", 0, Time[20], g_price_124);
      ObjectCreate("S2_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_132);
      ObjectSet("S2_Line", OBJPROP_COLOR, LightSlateGray);
      ObjectSet("S2_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("S2_Label") != 0) {
         ObjectCreate("S2_Label", OBJ_TEXT, 0, Time[20], g_price_132);
         ObjectSetText("S2_Label", "Daily S2", 8, "Arial", LimeGreen);
      } else ObjectMove("S2_Label", 0, Time[20], g_price_132);
      ObjectCreate("S3_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_140);
      ObjectSet("S3_Line", OBJPROP_COLOR, LightSlateGray);
      ObjectSet("S3_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("S3_Label") != 0) {
         ObjectCreate("S3_Label", OBJ_TEXT, 0, Time[20], g_price_140);
         ObjectSetText("S3_Label", "Daily S3", 8, "Arial", LimeGreen);
      } else ObjectMove("S3_Label", 0, Time[20], g_price_140);
   }
   ObjectsRedraw();
   if (Weekly == TRUE) {
      ObjectCreate("WeekPivotLine", OBJ_HLINE, 0, TimeCurrent(), g_price_200);
      ObjectSet("WeekPivotLine", OBJPROP_COLOR, Aqua);
      ObjectSet("WeekPivotLine", OBJPROP_STYLE, STYLE_DASH);
      if (ObjectFind("WeekPivotLabel") != 0) {
         ObjectCreate("WeekPivotLabel", OBJ_TEXT, 0, Time[30], g_price_200);
         ObjectSetText("WeekPivotLabel", "WeeklyPivot", 8, "Arial", Aqua);
      } else ObjectMove("WeekPivotLabel", 0, Time[30], g_price_200);
      ObjectCreate("WR1_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_232);
      ObjectSet("WR1_Line", OBJPROP_COLOR, Yellow);
      ObjectSet("WR1_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("WR1_Label") != 0) {
         ObjectCreate("WR1_Label", OBJ_TEXT, 0, Time[30], g_price_232);
         ObjectSetText("WR1_Label", " Weekly R1", 8, "Arial", Yellow);
      } else ObjectMove("WR1_Label", 0, Time[30], g_price_232);
      ObjectCreate("WR2_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_240);
      ObjectSet("WR2_Line", OBJPROP_COLOR, Yellow);
      ObjectSet("WR2_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("WR2_Label") != 0) {
         ObjectCreate("WR2_Label", OBJ_TEXT, 0, Time[30], g_price_240);
         ObjectSetText("WR2_Label", " Weekly R2", 8, "Arial", Yellow);
      } else ObjectMove("WR2_Label", 0, Time[30], g_price_240);
      ObjectCreate("WR3_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_248);
      ObjectSet("WR3_Line", OBJPROP_COLOR, Yellow);
      ObjectSet("WR3_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("WR3_Label") != 0) {
         ObjectCreate("WR3_Label", OBJ_TEXT, 0, Time[30], g_price_248);
         ObjectSetText("WR3_Label", " Weekly R3", 8, "Arial", Yellow);
      } else ObjectMove("WR3_Label", 0, Time[30], g_price_248);
      ObjectCreate("WS1_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_208);
      ObjectSet("WS1_Line", OBJPROP_COLOR, SteelBlue);
      ObjectSet("WS1_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("WS1_Label") != 0) {
         ObjectCreate("WS1_Label", OBJ_TEXT, 0, Time[30], g_price_208);
         ObjectSetText("WS1_Label", "Weekly S1", 8, "Arial", SteelBlue);
      } else ObjectMove("WS1_Label", 0, Time[30], g_price_208);
      ObjectCreate("WS2_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_216);
      ObjectSet("WS2_Line", OBJPROP_COLOR, SteelBlue);
      ObjectSet("WS2_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("WS2_Label") != 0) {
         ObjectCreate("WS2_Label", OBJ_TEXT, 0, Time[30], g_price_216);
         ObjectSetText("WS2_Label", "Weekly S2", 8, "Arial", SteelBlue);
      } else ObjectMove("WS2_Label", 0, Time[30], g_price_216);
      ObjectCreate("WS3_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_224);
      ObjectSet("WS3_Line", OBJPROP_COLOR, SteelBlue);
      ObjectSet("WS3_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("WS3_Label") != 0) {
         ObjectCreate("WS3_Label", OBJ_TEXT, 0, Time[30], g_price_224);
         ObjectSetText("WS3_Label", "Weekly S3", 8, "Arial", SteelBlue);
      } else ObjectMove("WS3_Label", 0, Time[30], g_price_224);
   }
   if (Monthly == TRUE) {
      ObjectCreate("MonthPivotLine", OBJ_HLINE, 0, TimeCurrent(), g_price_284);
      ObjectSet("MonthPivotLine", OBJPROP_COLOR, Brown);
      ObjectSet("MonthPivotLine", OBJPROP_STYLE, STYLE_DASH);
      if (ObjectFind("MonthPivotLabel") != 0) {
         ObjectCreate("MonthPivotLabel", OBJ_TEXT, 0, Time[40], g_price_284);
         ObjectSetText("MonthPivotLabel", "MonthlyPivot", 8, "Arial", Brown);
      } else ObjectMove("MonthPivotLabel", 0, Time[40], g_price_284);
      ObjectCreate("MR1_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_316);
      ObjectSet("MR1_Line", OBJPROP_COLOR, Blue);
      ObjectSet("MR1_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("MR1_Label") != 0) {
         ObjectCreate("MR1_Label", OBJ_TEXT, 0, Time[40], g_price_316);
         ObjectSetText("MR1_Label", " Monthly R1", 8, "Arial", Blue);
      } else ObjectMove("MR1_Label", 0, Time[40], g_price_316);
      ObjectCreate("MR2_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_324);
      ObjectSet("MR2_Line", OBJPROP_COLOR, Blue);
      ObjectSet("MR2_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("MR2_Label") != 0) {
         ObjectCreate("MR2_Label", OBJ_TEXT, 0, Time[40], g_price_324);
         ObjectSetText("MR2_Label", " Monthly R2", 8, "Arial", Blue);
      } else ObjectMove("MR2_Label", 0, Time[40], g_price_324);
      ObjectCreate("MR3_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_332);
      ObjectSet("MR3_Line", OBJPROP_COLOR, Blue);
      ObjectSet("MR3_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("MR3_Label") != 0) {
         ObjectCreate("MR3_Label", OBJ_TEXT, 0, Time[40], g_price_332);
         ObjectSetText("MR3_Label", " Monthly R3", 8, "Arial", Blue);
      } else ObjectMove("MR3_Label", 0, Time[40], g_price_332);
      ObjectCreate("MS1_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_292);
      ObjectSet("MS1_Line", OBJPROP_COLOR, Silver);
      ObjectSet("MS1_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("MS1_Label") != 0) {
         ObjectCreate("MS1_Label", OBJ_TEXT, 0, Time[40], g_price_292);
         ObjectSetText("MS1_Label", "Monthly S1", 8, "Arial", Silver);
      } else ObjectMove("MS1_Label", 0, Time[40], g_price_292);
      ObjectCreate("MS2_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_300);
      ObjectSet("MS2_Line", OBJPROP_COLOR, Silver);
      ObjectSet("MS2_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("MS2_Label") != 0) {
         ObjectCreate("MS2_Label", OBJ_TEXT, 0, Time[40], g_price_300);
         ObjectSetText("MS2_Label", "Monthly S2", 8, "Arial", Silver);
      } else ObjectMove("MS2_Label", 0, Time[40], g_price_300);
      ObjectCreate("MS3_Line", OBJ_HLINE, 0, TimeCurrent(), g_price_308);
      ObjectSet("MS3_Line", OBJPROP_COLOR, Silver);
      ObjectSet("MS3_Line", OBJPROP_STYLE, STYLE_DASHDOTDOT);
      if (ObjectFind("MS3_Label") != 0) {
         ObjectCreate("MS3_Label", OBJ_TEXT, 0, Time[40], g_price_308);
         ObjectSetText("MS3_Label", "Monthly S3", 8, "Arial", Silver);
      } else ObjectMove("MS3_Label", 0, Time[40], g_price_308);
   }
   ObjectsRedraw();
   return (0);
}
