FDM Hours Channel





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

#property indicator_chart_window

extern int Hours = 1080;
extern color col = LimeGreen;
double gd_84;
double gd_unused_92;
double gd_100;
double gd_108;
double gd_116;
double gd_124;
double gd_132;
double gd_140;
double gd_148;
int gi_156;
int gi_160;
int gi_168;
int gi_unused_176;
double gd_180;
double gd_188;
double gd_196;
double gd_204;
double gd_212;
double gd_220;
int gi_232;
int gi_236;
int gi_240;
int gi_244;
double gd_248;
double gd_256;
double gd_264;
double gd_272;
double gd_280;
double gd_288;
double gd_296;
double gd_304;
double gd_312;
double gd_320;
double g_price_328;
double g_price_336;
double g_price_344;
double g_price_352;
double g_price_360;
double g_price_368;
int g_shift_376;
int g_shift_380;
int g_shift_384;
bool gi_388;

void ObjDel() {
   ObjectDelete("1" + gi_160);
   ObjectDelete("0" + gi_160);
   ObjectDelete("2" + gi_160);
}

int init() {
   return (0);
}

int deinit() {
   ObjDel();
   Comment("");
   return (0);
}

int start() {
   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);
   }
   gi_156 = 60 * Hours / Period();
   gi_160 = Hours;
   if (gi_168 == 1) {
      g_shift_376 = iBarShift(Symbol(), Period(), ObjectGet("1" + gi_160, OBJPROP_TIME1));
      g_shift_380 = iBarShift(Symbol(), Period(), ObjectGet("0" + gi_160, OBJPROP_TIME1));
      g_shift_384 = iBarShift(Symbol(), Period(), ObjectGet("2" + gi_160, OBJPROP_TIME1));
      if (gi_388 == FALSE && gi_156 != g_shift_376) {
         gi_156 = g_shift_376;
         gi_388 = TRUE;
      }
      if (gi_388 == FALSE && gi_156 != g_shift_380) {
         gi_156 = g_shift_380;
         gi_388 = TRUE;
      }
      if (gi_388 == FALSE && gi_156 != g_shift_384) {
         gi_156 = g_shift_384;
         gi_388 = TRUE;
      }
   }
   gd_108 = 0;
   gd_116 = 0;
   gd_124 = 0;
   gd_132 = 0;
   for (int li_16 = 0; li_16 <= gi_156; li_16++) {
      gd_108 += li_16;
      gd_116 += Close[li_16];
      gd_124 += li_16 * Close[li_16];
      gd_132 += MathPow(li_16, 2);
   }
   gd_140 = (gd_108 * gd_116 - (gi_156 + 1) * gd_124) / (MathPow(gd_108, 2) - (gi_156 + 1) * gd_132);
   gd_148 = (gd_116 - gd_140 * gd_108) / (gi_156 + 1);
   for (int l_index_12 = 0; l_index_12 <= gi_156; l_index_12++) {
      gd_84 = gd_148 + gd_140 * l_index_12;
      gd_180 = High[l_index_12] - gd_84;
      gd_188 = Low[l_index_12] - gd_84;
      if (l_index_12 < gi_156 / 2) {
         if (l_index_12 == 0) {
            gd_196 = 0.0;
            gd_204 = 0.0;
            gi_232 = l_index_12;
            gi_240 = l_index_12;
         }
         if (gd_180 >= gd_196) {
            gd_196 = gd_180;
            gi_232 = l_index_12;
         }
         if (gd_188 <= gd_204) {
            gd_204 = gd_188;
            gi_240 = l_index_12;
         }
      }
      if (l_index_12 >= gi_156 / 2) {
         if (l_index_12 == gi_156 / 2) {
            gd_212 = 0.0;
            gd_220 = 0.0;
            gi_236 = l_index_12;
            gi_244 = l_index_12;
         }
         if (gd_180 >= gd_212) {
            gd_212 = gd_180;
            gi_236 = l_index_12;
         }
         if (gd_188 <= gd_220) {
            gd_220 = gd_188;
            gi_244 = l_index_12;
         }
      }
   }
   gd_unused_92 = gd_148;
   gd_100 = gd_148 + gd_140 * (l_index_12 + gi_156);
   if (MathAbs(gi_232 - gi_236) > MathAbs(gi_240 - gi_244)) gi_168 = 1;
   if (MathAbs(gi_232 - gi_236) < MathAbs(gi_240 - gi_244)) gi_168 = 2;
   if (MathAbs(gi_232 - gi_236) == MathAbs(gi_240 - gi_244)) {
      if (MathAbs(gd_196 - gd_212) < MathAbs(gd_204 - gd_220)) gi_168 = 1;
      if (MathAbs(gd_196 - gd_212) >= MathAbs(gd_204 - gd_220)) gi_168 = 2;
   }
   if (gi_168 == 1) {
      for (li_16 = 0; li_16 <= 20; li_16++) {
         gi_unused_176 = 0;
         for (l_index_12 = 0; l_index_12 <= gi_156; l_index_12++) {
            gd_248 = High[gi_232] * (l_index_12 - gi_236) / (gi_232 - gi_236) + High[gi_236] * (l_index_12 - gi_232) / (gi_236 - gi_232);
            if (l_index_12 == 0 || l_index_12 == gi_156 / 2) gd_280 = 0.0;
            if (High[l_index_12] - gd_248 > gd_280 && l_index_12 < gi_156 / 2) {
               gi_232 = l_index_12;
               gi_unused_176 = 1;
            }
            if (High[l_index_12] - gd_248 > gd_280 && l_index_12 >= gi_156 / 2) {
               gi_236 = l_index_12;
               gi_unused_176 = 1;
            }
         }
         if (gi_168 == 0) break;
      }
      for (l_index_12 = 0; l_index_12 <= gi_156; l_index_12++) {
         gd_248 = High[gi_232] * (l_index_12 - gi_236) / (gi_232 - gi_236) + High[gi_236] * (l_index_12 - gi_232) / (gi_236 - gi_232);
         gd_272 = Low[l_index_12] - gd_248;
         if (l_index_12 == 0) gd_288 = 0.0;
         if (gd_272 < gd_288) gd_288 = gd_272;
      }
      gd_296 = High[gi_232] * (0 - gi_236) / (gi_232 - gi_236) + High[gi_236] * (0 - gi_232) / (gi_236 - gi_232);
      gd_304 = High[gi_232] * (gi_156 - gi_236) / (gi_232 - gi_236) + High[gi_236] * (gi_156 - gi_232) / (gi_236 - gi_232);
      g_price_328 = gd_304;
      g_price_336 = gd_304 + gd_288 / 2.0;
      g_price_344 = gd_304 + gd_288;
      g_price_352 = gd_296;
      g_price_360 = gd_296 + gd_288 / 2.0;
      g_price_368 = gd_296 + gd_288;
   }
   if (gi_168 == 2) {
      for (li_16 = 0; li_16 <= 20; li_16++) {
         gi_unused_176 = 0;
         for (l_index_12 = 0; l_index_12 <= gi_156; l_index_12++) {
            gd_256 = Low[gi_240] * (l_index_12 - gi_244) / (gi_240 - gi_244) + Low[gi_244] * (l_index_12 - gi_240) / (gi_244 - gi_240);
            if (l_index_12 == 0 || l_index_12 == gi_156 / 2) gd_288 = 0.0;
            if (Low[l_index_12] - gd_256 < gd_288 && l_index_12 < gi_156 / 2) {
               gi_240 = l_index_12;
               gi_unused_176 = 1;
            }
            if (Low[l_index_12] - gd_256 < gd_288 && l_index_12 >= gi_156 / 2) {
               gi_244 = l_index_12;
               gi_unused_176 = 1;
            }
         }
         if (gi_168 == 0) break;
      }
      for (l_index_12 = 0; l_index_12 <= gi_156; l_index_12++) {
         gd_256 = Low[gi_240] * (l_index_12 - gi_244) / (gi_240 - gi_244) + Low[gi_244] * (l_index_12 - gi_240) / (gi_244 - gi_240);
         gd_264 = High[l_index_12] - gd_256;
         if (l_index_12 == 0) gd_280 = 0.0;
         if (gd_264 > gd_280) gd_280 = gd_264;
      }
      gd_312 = Low[gi_240] * (0 - gi_244) / (gi_240 - gi_244) + Low[gi_244] * (0 - gi_240) / (gi_244 - gi_240);
      gd_320 = Low[gi_240] * (gi_156 - gi_244) / (gi_240 - gi_244) + Low[gi_244] * (gi_156 - gi_240) / (gi_244 - gi_240);
      g_price_328 = gd_320;
      g_price_336 = gd_320 + gd_280 / 2.0;
      g_price_344 = gd_320 + gd_280;
      g_price_352 = gd_312;
      g_price_360 = gd_312 + gd_280 / 2.0;
      g_price_368 = gd_312 + gd_280;
   }
   ObjectCreate("1" + gi_160, OBJ_TREND, 0, Time[gi_156], g_price_328, Time[0], g_price_352);
   ObjectCreate("0" + gi_160, OBJ_TREND, 0, Time[gi_156], g_price_336, Time[0], g_price_360);
   ObjectCreate("2" + gi_160, OBJ_TREND, 0, Time[gi_156], g_price_344, Time[0], g_price_368);
   ObjectSet("1" + gi_160, OBJPROP_COLOR, col);
   ObjectSet("0" + gi_160, OBJPROP_COLOR, col);
   ObjectSet("0" + gi_160, OBJPROP_STYLE, STYLE_DOT);
   ObjectSet("2" + gi_160, OBJPROP_COLOR, col);
   return (0);
}



Sample





Analysis



Market Information Used:

Series array that contains close prices for each bar
Series array that contains the highest prices of each bar
Series array that contains the lowest prices of each bar
Series array that contains open time of each bar


Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features:

It issuies visual alerts to the screen