/*
   
*/
#property copyright "Copyright © 2008, Forex Day Monster"
#property link      "http://www.forexprofitmonster.com"

#property indicator_separate_window

extern int SpreadThreshold = 6;
extern bool Show_D1_ADX = TRUE;

int init() {
   IndicatorShortName("FDM Trend Power (" + Symbol() + ")");
   return (0);
}

int deinit() {
   ObjectsDeleteAll(0, OBJ_LABEL);
   ObjectDelete("FDM Trend Power-1");
   ObjectDelete("FDM Trend Power-2");
   ObjectDelete("FDM Trend Power-3");
   ObjectDelete("FDM Trend Power-4");
   ObjectDelete("FDM Trend Power-5");
   ObjectDelete("FDM Trend Power-6");
   ObjectDelete("FDM Trend Power-7");
   ObjectDelete("FDM Trend Power-8");
   ObjectDelete("FDM Trend Power-9");
   ObjectDelete("FDM Trend Power-10");
   ObjectDelete("FDM Trend Power-11");
   ObjectDelete("FDM Trend Power-12");
   ObjectDelete("FDM Trend Power-2a");
   ObjectDelete("FDM Trend Power-4a");
   ObjectDelete("FDM Trend Power-6a");
   ObjectDelete("FDM Trend Power-8a");
   ObjectDelete("FDM Trend Power-10a");
   ObjectDelete("FDM Trend Power-12a");
   return (0);
}

int start() {
   color l_color_156;
   color l_color_160;
   color l_color_164;
   color l_color_168;
   color l_color_172;
   color l_color_176;
   string l_text_180;
   string l_text_188;
   string l_text_196;
   string l_text_204;
   string l_text_212;
   string l_text_220;
   string ls_0 = "2015.11.01";
   int l_str2time_8 = StrToTime(ls_0);
   if (TimeCurrent() >= l_str2time_8) {
      Alert(" Trial version has expired! Email support@forexprofitmonster.com with broker account number for rights to full version!");
      return (0);
   }
   double l_iadx_12 = iADX(NULL, PERIOD_M5, 14, PRICE_CLOSE, MODE_MAIN, 0);
   double l_iadx_20 = iADX(NULL, PERIOD_M5, 14, PRICE_CLOSE, MODE_PLUSDI, 0);
   double l_iadx_28 = iADX(NULL, PERIOD_M5, 14, PRICE_CLOSE, MODE_MINUSDI, 0);
   double l_iadx_36 = iADX(NULL, PERIOD_M15, 14, PRICE_CLOSE, MODE_MAIN, 0);
   double l_iadx_44 = iADX(NULL, PERIOD_M15, 14, PRICE_CLOSE, MODE_PLUSDI, 0);
   double l_iadx_52 = iADX(NULL, PERIOD_M15, 14, PRICE_CLOSE, MODE_MINUSDI, 0);
   double l_iadx_60 = iADX(NULL, PERIOD_M30, 14, PRICE_CLOSE, MODE_MAIN, 0);
   double l_iadx_68 = iADX(NULL, PERIOD_M30, 14, PRICE_CLOSE, MODE_PLUSDI, 0);
   double l_iadx_76 = iADX(NULL, PERIOD_M30, 14, PRICE_CLOSE, MODE_MINUSDI, 0);
   double l_iadx_84 = iADX(NULL, PERIOD_H1, 14, PRICE_CLOSE, MODE_MAIN, 0);
   double l_iadx_92 = iADX(NULL, PERIOD_H1, 14, PRICE_CLOSE, MODE_PLUSDI, 0);
   double l_iadx_100 = iADX(NULL, PERIOD_H1, 14, PRICE_CLOSE, MODE_MINUSDI, 0);
   double l_iadx_108 = iADX(NULL, PERIOD_H4, 14, PRICE_CLOSE, MODE_MAIN, 0);
   double l_iadx_116 = iADX(NULL, PERIOD_H4, 14, PRICE_CLOSE, MODE_PLUSDI, 0);
   double l_iadx_124 = iADX(NULL, PERIOD_H4, 14, PRICE_CLOSE, MODE_MINUSDI, 0);
   double l_iadx_132 = iADX(NULL, PERIOD_D1, 14, PRICE_CLOSE, MODE_MAIN, 0);
   double l_iadx_140 = iADX(NULL, PERIOD_D1, 14, PRICE_CLOSE, MODE_PLUSDI, 0);
   double l_iadx_148 = iADX(NULL, PERIOD_D1, 14, PRICE_CLOSE, MODE_MINUSDI, 0);
   if (l_iadx_12 < 23.0 && l_iadx_12 != 0.0) l_color_156 = LightSkyBlue;
   if (l_iadx_12 >= 23.0 && l_iadx_20 > l_iadx_28) l_color_156 = Lime;
   if (l_iadx_12 >= 23.0 && l_iadx_20 < l_iadx_28) l_color_156 = Red;
   if (l_iadx_36 < 23.0 && l_iadx_36 != 0.0) l_color_160 = LightSkyBlue;
   if (l_iadx_36 >= 23.0 && l_iadx_44 > l_iadx_52) l_color_160 = Lime;
   if (l_iadx_36 >= 23.0 && l_iadx_44 < l_iadx_52) l_color_160 = Red;
   if (l_iadx_60 < 23.0 && l_iadx_60 != 0.0) l_color_164 = LightSkyBlue;
   if (l_iadx_60 >= 23.0 && l_iadx_68 > l_iadx_76) l_color_164 = Lime;
   if (l_iadx_60 >= 23.0 && l_iadx_68 < l_iadx_76) l_color_164 = Red;
   if (l_iadx_84 < 23.0 && l_iadx_84 != 0.0) l_color_168 = LightSkyBlue;
   if (l_iadx_84 >= 23.0 && l_iadx_92 > l_iadx_100) l_color_168 = Lime;
   if (l_iadx_84 >= 23.0 && l_iadx_92 < l_iadx_100) l_color_168 = Red;
   if (l_iadx_108 < 23.0 && l_iadx_108 != 0.0) l_color_172 = LightSkyBlue;
   if (l_iadx_108 >= 23.0 && l_iadx_116 > l_iadx_124) l_color_172 = Lime;
   if (l_iadx_108 >= 23.0 && l_iadx_116 < l_iadx_124) l_color_172 = Red;
   if (l_iadx_132 < 23.0 && l_iadx_132 != 0.0) l_color_176 = LightSkyBlue;
   if (l_iadx_132 >= 23.0 && l_iadx_140 > l_iadx_148) l_color_176 = Lime;
   if (l_iadx_132 >= 23.0 && l_iadx_140 < l_iadx_148) l_color_176 = Red;
   string l_iadx_228 = l_iadx_12;
   string l_iadx_236 = l_iadx_36;
   string l_iadx_244 = l_iadx_60;
   string l_iadx_252 = l_iadx_84;
   string l_iadx_260 = l_iadx_108;
   string l_iadx_268 = l_iadx_132;
   if (l_iadx_12 < 23.0 && l_iadx_12 != 0.0) l_text_180 = "h";
   if (l_iadx_12 >= 23.0 && l_iadx_12 < 28.0 && l_iadx_20 > l_iadx_28) l_text_180 = "ì";
   if (l_iadx_12 >= 23.0 && l_iadx_12 < 28.0 && l_iadx_20 < l_iadx_28) l_text_180 = "î";
   if (l_iadx_12 >= 28.0 && l_iadx_20 > l_iadx_28) l_text_180 = "é";
   if (l_iadx_12 >= 28.0 && l_iadx_20 < l_iadx_28) l_text_180 = "ê";
   if (l_iadx_36 < 23.0 && l_iadx_36 != 0.0) l_text_188 = "h";
   if (l_iadx_36 >= 23.0 && l_iadx_36 < 28.0 && l_iadx_44 > l_iadx_52) l_text_188 = "ì";
   if (l_iadx_36 >= 23.0 && l_iadx_36 < 28.0 && l_iadx_44 < l_iadx_52) l_text_188 = "î";
   if (l_iadx_36 >= 28.0 && l_iadx_44 > l_iadx_52) l_text_188 = "é";
   if (l_iadx_36 >= 28.0 && l_iadx_44 < l_iadx_52) l_text_188 = "ê";
   if (l_iadx_60 < 23.0 && l_iadx_60 != 0.0) l_text_196 = "h";
   if (l_iadx_60 >= 23.0 && l_iadx_60 < 28.0 && l_iadx_68 > l_iadx_76) l_text_196 = "ì";
   if (l_iadx_60 >= 23.0 && l_iadx_60 < 28.0 && l_iadx_68 < l_iadx_76) l_text_196 = "î";
   if (l_iadx_60 >= 28.0 && l_iadx_68 > l_iadx_76) l_text_196 = "é";
   if (l_iadx_60 >= 28.0 && l_iadx_68 < l_iadx_76) l_text_196 = "ê";
   if (l_iadx_84 < 23.0 && l_iadx_84 != 0.0) l_text_204 = "h";
   if (l_iadx_84 >= 23.0 && l_iadx_84 < 28.0 && l_iadx_92 > l_iadx_100) l_text_204 = "ì";
   if (l_iadx_84 >= 23.0 && l_iadx_84 < 28.0 && l_iadx_92 < l_iadx_100) l_text_204 = "î";
   if (l_iadx_84 >= 28.0 && l_iadx_92 > l_iadx_100) l_text_204 = "é";
   if (l_iadx_84 >= 28.0 && l_iadx_92 < l_iadx_100) l_text_204 = "ê";
   if (l_iadx_108 < 23.0 && l_iadx_108 != 0.0) l_text_212 = "h";
   if (l_iadx_108 >= 23.0 && l_iadx_108 < 28.0 && l_iadx_116 > l_iadx_124) l_text_212 = "ì";
   if (l_iadx_108 >= 23.0 && l_iadx_108 < 28.0 && l_iadx_116 < l_iadx_124) l_text_212 = "î";
   if (l_iadx_108 >= 28.0 && l_iadx_116 > l_iadx_124) l_text_212 = "é";
   if (l_iadx_108 >= 28.0 && l_iadx_116 < l_iadx_124) l_text_212 = "ê";
   if (l_iadx_132 < 23.0 && l_iadx_132 != 0.0) l_text_220 = "h";
   if (l_iadx_132 >= 23.0 && l_iadx_132 < 28.0 && l_iadx_140 > l_iadx_148) l_text_220 = "ì";
   if (l_iadx_132 >= 23.0 && l_iadx_132 < 28.0 && l_iadx_140 < l_iadx_148) l_text_220 = "î";
   if (l_iadx_132 >= 28.0 && l_iadx_140 > l_iadx_148) l_text_220 = "é";
   if (l_iadx_132 >= 28.0 && l_iadx_140 < l_iadx_148) l_text_220 = "ê";
   ObjectCreate("FDM Trend Power-1", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-1", "5 Min:", 9, "Lucida Sans Regular", LightSteelBlue);
   ObjectSet("FDM Trend Power-1", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-1", OBJPROP_XDISTANCE, 185);
   ObjectSet("FDM Trend Power-1", OBJPROP_YDISTANCE, 2);
   ObjectCreate("FDM Trend Power-2", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-2", " ADX " + StringSubstr(l_iadx_228, 0, 5) + " ", 9, "Lucida Sands Regular", l_color_156);
   ObjectSet("FDM Trend Power-2", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-2", OBJPROP_XDISTANCE, 225);
   ObjectSet("FDM Trend Power-2", OBJPROP_YDISTANCE, 2);
   ObjectCreate("FDM Trend Power-2a", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-2a", l_text_180, 9, "Wingdings", l_color_156);
   ObjectSet("FDM Trend Power-2a", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-2a", OBJPROP_XDISTANCE, 288);
   ObjectSet("FDM Trend Power-2a", OBJPROP_YDISTANCE, 2);
   ObjectCreate("FDM Trend Power-3", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-3", "15 Min:", 9, "Lucida Sans Regular", LightSteelBlue);
   ObjectSet("FDM Trend Power-3", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-3", OBJPROP_XDISTANCE, 318);
   ObjectSet("FDM Trend Power-3", OBJPROP_YDISTANCE, 2);
   ObjectCreate("FDM Trend Power-4", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-4", " ADX " + StringSubstr(l_iadx_236, 0, 5) + " ", 9, "Lucida Sands Regular", l_color_160);
   ObjectSet("FDM Trend Power-4", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-4", OBJPROP_XDISTANCE, 363);
   ObjectSet("FDM Trend Power-4", OBJPROP_YDISTANCE, 2);
   ObjectCreate("FDM Trend Power-4a", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-4a", l_text_188, 9, "Wingdings", l_color_160);
   ObjectSet("FDM Trend Power-4a", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-4a", OBJPROP_XDISTANCE, 426);
   ObjectSet("FDM Trend Power-4a", OBJPROP_YDISTANCE, 2);
   ObjectCreate("FDM Trend Power-5", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-5", "M30:", 9, "Lucida Sans Regular", LightSteelBlue);
   ObjectSet("FDM Trend Power-5", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-5", OBJPROP_XDISTANCE, 456);
   ObjectSet("FDM Trend Power-5", OBJPROP_YDISTANCE, 2);
   ObjectCreate("FDM Trend Power-6", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-6", " ADX " + StringSubstr(l_iadx_244, 0, 5) + " ", 9, "Lucida Sands Regular", l_color_164);
   ObjectSet("FDM Trend Power-6", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-6", OBJPROP_XDISTANCE, 490);
   ObjectSet("FDM Trend Power-6", OBJPROP_YDISTANCE, 2);
   ObjectCreate("FDM Trend Power-6a", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-6a", l_text_196, 9, "Wingdings", l_color_164);
   ObjectSet("FDM Trend Power-6a", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-6a", OBJPROP_XDISTANCE, 553);
   ObjectSet("FDM Trend Power-6a", OBJPROP_YDISTANCE, 2);
   ObjectCreate("FDM Trend Power-7", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-7", "1 Hr:", 9, "Lucida Sans Regular", LightSteelBlue);
   ObjectSet("FDM Trend Power-7", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-7", OBJPROP_XDISTANCE, 580);
   ObjectSet("FDM Trend Power-7", OBJPROP_YDISTANCE, 2);
   ObjectCreate("FDM Trend Power-8", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-8", " ADX " + StringSubstr(l_iadx_252, 0, 5) + " ", 9, "Lucida Sands Regular", l_color_168);
   ObjectSet("FDM Trend Power-8", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-8", OBJPROP_XDISTANCE, 610);
   ObjectSet("FDM Trend Power-8", OBJPROP_YDISTANCE, 2);
   ObjectCreate("FDM Trend Power-8a", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-8a", l_text_204, 9, "Wingdings", l_color_168);
   ObjectSet("FDM Trend Power-8a", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-8a", OBJPROP_XDISTANCE, 672);
   ObjectSet("FDM Trend Power-8a", OBJPROP_YDISTANCE, 2);
   ObjectCreate("FDM Trend Power-9", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-9", "4 Hr:", 9, "Lucida Sans Regular", LightSteelBlue);
   ObjectSet("FDM Trend Power-9", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-9", OBJPROP_XDISTANCE, 702);
   ObjectSet("FDM Trend Power-9", OBJPROP_YDISTANCE, 2);
   ObjectCreate("FDM Trend Power-10", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-10", " ADX " + StringSubstr(l_iadx_260, 0, 5) + " ", 9, "Lucida Sands Regular", l_color_172);
   ObjectSet("FDM Trend Power-10", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-10", OBJPROP_XDISTANCE, 732);
   ObjectSet("FDM Trend Power-10", OBJPROP_YDISTANCE, 2);
   ObjectCreate("FDM Trend Power-10a", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
   ObjectSetText("FDM Trend Power-10a", l_text_212, 9, "Wingdings", l_color_172);
   ObjectSet("FDM Trend Power-10a", OBJPROP_CORNER, 0);
   ObjectSet("FDM Trend Power-10a", OBJPROP_XDISTANCE, 793);
   ObjectSet("FDM Trend Power-10a", OBJPROP_YDISTANCE, 2);
   if (Show_D1_ADX == TRUE) {
      ObjectCreate("FDM Trend Power-11", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
      ObjectSetText("FDM Trend Power-11", "1 Day:", 9, "Lucida Sans Regular", LightSteelBlue);
      ObjectSet("FDM Trend Power-11", OBJPROP_CORNER, 0);
      ObjectSet("FDM Trend Power-11", OBJPROP_XDISTANCE, 823);
      ObjectSet("FDM Trend Power-11", OBJPROP_YDISTANCE, 2);
      ObjectCreate("FDM Trend Power-12", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
      ObjectSetText("FDM Trend Power-12", " ADX " + StringSubstr(l_iadx_268, 0, 5) + " ", 9, "Lucida Sands Regular", l_color_176);
      ObjectSet("FDM Trend Power-12", OBJPROP_CORNER, 0);
      ObjectSet("FDM Trend Power-12", OBJPROP_XDISTANCE, 863);
      ObjectSet("FDM Trend Power-12", OBJPROP_YDISTANCE, 2);
      ObjectCreate("FDM Trend Power-12a", OBJ_LABEL, WindowFind("FDM Trend Power (" + Symbol() + ")"), 0, 0);
      ObjectSetText("FDM Trend Power-12a", l_text_220, 9, "Wingdings", l_color_176);
      ObjectSet("FDM Trend Power-12a", OBJPROP_CORNER, 0);
      ObjectSet("FDM Trend Power-12a", OBJPROP_XDISTANCE, 923);
      ObjectSet("FDM Trend Power-12a", OBJPROP_YDISTANCE, 2);
   }
   return (0);
}