FDM_Multi-Trend





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

#property indicator_separate_window
#property indicator_minimum 0.0
#property indicator_maximum 1.0
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Lime
#property indicator_color3 Salmon
#property indicator_color4 LightGreen

extern int Minutes = 5;
int gi_80 = 13;
int gi_84 = 6;
double g_ibuf_88[];
double g_ibuf_92[];
double g_ibuf_96[];
double g_ibuf_100[];
double gda_104[];
double g_iadx_132;
double g_iadx_140;
string gs_148;
double gd_156;
double g_ilow_164 = 0.0;
double g_ihigh_172 = 0.0;
double gd_180 = 0.0;
double gd_188 = 0.0;
double gd_unused_196 = 0.0;
double gd_204 = 0.0;
double gd_212 = 0.0;
double gd_220 = 0.0;

int init() {
   IndicatorBuffers(5);
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 5);
   SetIndexBuffer(0, g_ibuf_88);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 5);
   SetIndexBuffer(1, g_ibuf_92);
   SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 2);
   SetIndexBuffer(2, g_ibuf_96);
   SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID, 2);
   SetIndexBuffer(3, g_ibuf_100);
   SetIndexLabel(0, NULL);
   SetIndexLabel(1, NULL);
   SetIndexLabel(2, NULL);
   SetIndexLabel(3, NULL);
   SetIndexLabel(4, NULL);
   switch (Minutes) {
   case 1:
      gs_148 = "Period_M1";
      break;
   case 5:
      gs_148 = "Period_M5";
      break;
   case 15:
      gs_148 = "Period_M15";
      break;
   case 30:
      gs_148 = "Period_M30";
      break;
   case 60:
      gs_148 = "Period_H1";
      break;
   case 240:
      gs_148 = "Period_H4";
      break;
   case 1440:
      gs_148 = "Period_D1";
      break;
   case 10080:
      gs_148 = "Period_W1";
      break;
   case 43200:
      gs_148 = "Period_MN1";
      break;
   default:
      gs_148 = "Current Timeframe";
      Minutes = 0;
   }
   IndicatorShortName("FDM Multi-Trend (" + gs_148 + ")");
   return (0);
}

int deinit() {
   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);
   }
   int li_unused_12 = IndicatorCounted();
   for (int li_16 = 800; li_16 > -1; li_16--) {
      g_ibuf_88[li_16] = 0;
      g_ibuf_92[li_16] = 0;
      g_ibuf_96[li_16] = 0;
      g_ibuf_100[li_16] = 0;
      gda_104[li_16] = 0;
      g_iadx_132 = iADX(NULL, Minutes, 14, PRICE_CLOSE, MODE_PLUSDI, li_16);
      g_iadx_140 = iADX(NULL, Minutes, 14, PRICE_CLOSE, MODE_MINUSDI, li_16);
      g_ihigh_172 = iHigh(NULL, Minutes, iHighest(NULL, Minutes, MODE_HIGH, gi_80, li_16));
      g_ilow_164 = iLow(NULL, Minutes, iLowest(NULL, Minutes, MODE_LOW, gi_80, li_16));
      gd_156 = (iHigh(NULL, Minutes, li_16) + iLow(NULL, Minutes, li_16)) / 2.0;
      if (gi_84 == 1) gd_156 = iOpen(NULL, Minutes, li_16);
      if (gi_84 == 2) gd_156 = iClose(NULL, Minutes, li_16);
      if (gi_84 == 3) gd_156 = iHigh(NULL, Minutes, li_16);
      if (gi_84 == 4) gd_156 = iLow(NULL, Minutes, li_16);
      if (gi_84 == 5) gd_156 = (iHigh(NULL, Minutes, li_16) + iLow(NULL, Minutes, li_16) + iClose(NULL, Minutes, li_16)) / 3.0;
      if (gi_84 == 6) gd_156 = (iOpen(NULL, Minutes, li_16) + iHigh(NULL, Minutes, li_16) + iLow(NULL, Minutes, li_16) + iClose(NULL, Minutes, li_16)) / 4.0;
      if (gi_84 == 7) gd_156 = (iOpen(NULL, Minutes, li_16) + iClose(NULL, Minutes, li_16)) / 2.0;
      gd_180 = 0.66 * ((gd_156 - g_ilow_164) / (g_ihigh_172 - g_ilow_164) - 0.5) + 0.67 * gd_188;
      gd_180 = MathMin(MathMax(gd_180, -0.999), 0.999);
      gd_204 = MathLog((gd_180 + 1.0) / (1 - gd_180)) / 2.0 - gd_212 / 2.0 - gd_220 / 2.0;
      if (gd_204 > 0.0 && g_iadx_132 > g_iadx_140) g_ibuf_92[li_16] = 1;
      if (gd_204 > 0.0 && g_iadx_140 > g_iadx_132) g_ibuf_100[li_16] = 1;
      if (gd_204 < 0.0 && g_iadx_140 > g_iadx_132) g_ibuf_88[li_16] = 1;
      if (gd_204 < 0.0 && g_iadx_132 > g_iadx_140) g_ibuf_96[li_16] = 1;
      if (g_ibuf_88[li_16] == 0.0 && g_ibuf_92[li_16] == 0.0) {
      }
      if (gd_204 == 0.0 && g_iadx_132 > g_iadx_140) g_ibuf_92[li_16] = 1;
      if (gd_204 == 0.0 && g_iadx_132 < g_iadx_140) g_ibuf_88[li_16] = 1;
      gd_188 = gd_180;
      gd_220 = gd_212;
      gd_212 = gd_204;
   }
   return (0);
}



Sample





Analysis



Market Information Used:

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 prices of each bar
Series array that contains close prices for each bar


Indicator Curves created:

Implements a curve of type DRAW_HISTOGRAM


Indicators Used:

Movement directional index


Custom Indicators Used:

Order Management characteristics:

Other Features:

It issuies visual alerts to the screen