TRUE Forex

Просмотр кода форекс индикатора !SuperADX.mq4

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

#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Yellow
#property indicator_color2 Magenta
#property indicator_color3 Red
#property indicator_color4 DarkOrange
#property indicator_color5 DarkViolet

/*#import "MT4.SuperADX_Indicator.dll"
   bool Activate(int a0, int a1, string a2);
   string GetLastErrorDescription();
#import*/

//extern string License = "Enter License key here";
extern int WhiteBarTrigger = 35;
extern int RedBarTrigger = 10;
extern int WavePeriod = 10;
extern int AvgPeriod = 21;
extern bool SoundAlert = FALSE;
extern bool EmailAlert = FALSE;
extern int NumberOfBarsToUse = 500;
double g_ibuf_112[];
double g_ibuf_116[];
double g_ibuf_120[];
double g_ibuf_124[];
double g_ibuf_128[];
double gda_132[];
double gda_136[];
double gda_140[];
double gda_144[];
double gda_148[];
double gda_152[];
double gda_156[];
double gda_160[];
int gi_164 = -50;
int gi_168 = 53;
int gi_172;
bool gi_176 = FALSE;
bool gi_180 = FALSE;
string gs_184;

int init() {
   int li_8;
   string ls_0 = "!SuperADX";
   IndicatorShortName(ls_0);
   ArrayResize(gda_140, Bars);
   ArrayResize(gda_152, Bars);
   ArrayResize(gda_144, Bars);
   ArrayResize(gda_148, Bars);
   ArrayResize(gda_132, Bars);
   ArrayResize(gda_136, Bars);
   ArrayResize(gda_156, Bars);
   ArrayResize(gda_160, Bars);
   SetIndexBuffer(0, g_ibuf_124);
   SetIndexBuffer(1, g_ibuf_120);
   SetIndexBuffer(2, g_ibuf_116);
   SetIndexBuffer(3, g_ibuf_112);
   SetIndexBuffer(4, g_ibuf_128);
   SetIndexLabel(0, "Yellow Bar 53");
   SetIndexLabel(1, "Magenta Bar 53");
   SetIndexLabel(2, "Red Bar 53");
   SetIndexLabel(3, "DarkOrange Bar 53");
   SetIndexLabel(4, "DarkViolet Bar 53");
   SetIndexEmptyValue(0, 0);
   SetIndexEmptyValue(0, 1);
   SetIndexEmptyValue(0, 2);
   SetIndexEmptyValue(0, 3);
   SetIndexEmptyValue(0, 4);
   SetIndexDrawBegin(0, 1);
   SetIndexDrawBegin(1, 1);
   SetIndexDrawBegin(2, 1);
   SetIndexDrawBegin(3, 1);
   SetIndexDrawBegin(4, 1);
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 4);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 4);
   SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 4);
   SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID, 4);
   SetIndexStyle(4, DRAW_HISTOGRAM, STYLE_SOLID, 4);
   /*if (IsDemo()) li_8 = 1;
   else li_8 = 2;
   if (AccountNumber() == 0) gi_176 = TRUE;
   gi_180 = Activate(AccountNumber(), li_8, License);
   gs_184 = GetLastErrorDescription();*/
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   //int li_unused_0;
   int li_4;
   double l_ima_on_arr_8;
   int li_16;
   bool li_48;
   bool l_bool_52;
   bool l_bool_56;
   /*if (gi_176) {
      if (AccountNumber() == 0) {
         Comment("Connecting to server...");
         return (0);
      }
      gi_176 = FALSE;
      if (IsDemo()) li_unused_0 = 1;
      else li_unused_0 = 2;
      gi_180 = TRUE;
      gs_184 = GetLastErrorDescription();
      li_4 = 0;
   } else 
   if (gi_180 == FALSE) {
      Comment(gs_184);
      return (0);
   }
   Comment("License Activated");*/
   double l_icustom_20 = 0;
   double l_icustom_28 = 0;
   double l_icustom_36 = 0;
   li_4 = IndicatorCounted();
   if (li_4 < 0) return (-1);
   if (li_4 > 0) li_4--;
   if (NumberOfBarsToUse == 0) li_16 = Bars - 1;
   else li_16 = NumberOfBarsToUse;
   for (int li_44 = li_16; li_44 > 0; li_44--) {
      gda_140[li_44] = iMA(NULL, 0, WavePeriod, 0, MODE_EMA, PRICE_TYPICAL, li_44);
      ArraySetAsSeries(gda_140, TRUE);
   }
   for (li_44 = li_16; li_44 > 0; li_44--) {
      gda_152[li_44] = MathAbs((iHigh(NULL, 0, li_44) + iClose(NULL, 0, li_44) + iLow(NULL, 0, li_44)) / 3.0 - gda_140[li_44]);
      ArraySetAsSeries(gda_152, TRUE);
   }
   for (li_44 = li_16; li_44 > 0; li_44--) {
      l_ima_on_arr_8 = iMAOnArray(gda_152, 0, WavePeriod, 0, MODE_EMA, li_44);
      gda_144[li_44] = l_ima_on_arr_8;
      ArraySetAsSeries(gda_144, TRUE);
   }
   for (li_44 = li_16; li_44 > 0; li_44--) {
      if (gda_144[li_44] > 0.0) gda_148[li_44] = ((iHigh(NULL, 0, li_44) + iClose(NULL, 0, li_44) + iLow(NULL, 0, li_44)) / 3.0 - gda_140[li_44]) / (0.015 * gda_144[li_44]);
      else gda_148[li_44] = 0;
      ArraySetAsSeries(gda_148, TRUE);
   }
   for (li_44 = li_16; li_44 > 0; li_44--) {
      l_ima_on_arr_8 = iMAOnArray(gda_148, 0, AvgPeriod, 0, MODE_EMA, li_44);
      gda_132[li_44] = l_ima_on_arr_8;
      ArraySetAsSeries(gda_132, TRUE);
   }
   for (li_44 = li_16; li_44 > 0; li_44--) {
      l_ima_on_arr_8 = iMAOnArray(gda_132, 0, 4, 0, MODE_SMA, li_44);
      gda_136[li_44] = l_ima_on_arr_8;
      ArraySetAsSeries(gda_136, TRUE);
   }
   for (li_44 = li_16 - 1; li_44 > 0; li_44--) {
      if (gda_132[li_44] >= gda_136[li_44] && gda_132[li_44 + 1] <= gda_136[li_44 + 1] && gda_132[li_44] <= gi_164) gda_156[li_44] = 1;
      else gda_156[li_44] = 0;
      if (gda_132[li_44] <= gda_136[li_44] && gda_132[li_44 + 1] >= gda_136[li_44 + 1] && gda_132[li_44] >= gi_168) gda_160[li_44] = 1;
      else gda_160[li_44] = 0;
   }
   for (li_44 = li_16 - 2; li_44 > 0; li_44--) {
      l_icustom_20 = iCustom(NULL, 0, "!SupportingADX", 14, NumberOfBarsToUse, 0, li_44);
      l_icustom_28 = iCustom(NULL, 0, "!SupportingADX", 14, NumberOfBarsToUse, 0, li_44 + 1);
      l_icustom_36 = iCustom(NULL, 0, "!SupportingADX", 14, NumberOfBarsToUse, 0, li_44 + 2);
      li_48 = MACDSignal(li_44);
      l_bool_52 = l_icustom_28 > WhiteBarTrigger && l_icustom_20 < l_icustom_28 && l_icustom_28 > l_icustom_36;
      l_bool_56 = l_icustom_20 < RedBarTrigger && l_icustom_20 > l_icustom_28 && l_icustom_28 < l_icustom_36;
      g_ibuf_112[li_44] = 0;
      g_ibuf_120[li_44] = 0;
      g_ibuf_128[li_44] = 0;
      g_ibuf_124[li_44] = 0;
      if (l_bool_52 && gda_156[li_44] != 0.0 || gda_160[li_44] != 0.0) {
         g_ibuf_124[li_44] = 2.5 * l_icustom_20;
         if (li_44 == 1) SendAlert("yb");
      }
      if (l_bool_52) {
         if (li_48) {
            g_ibuf_128[li_44] = 1.5 * l_icustom_20;
            if (li_44 == 1) SendAlert("wbmacd");
         } else {
            g_ibuf_112[li_44] = 1.5 * l_icustom_20;
            if (li_44 == 1) SendAlert("wb");
         }
      }
      if (ThreeBars(li_44) && l_bool_52) {
         g_ibuf_120[li_44] = 2.0 * l_icustom_20;
         if (li_44 == 1) SendAlert("tb");
      }
      if (l_bool_56) {
         g_ibuf_116[li_44] = 2.0 * l_icustom_20;
         if (li_44 == 1) SendAlert("rb");
      } else g_ibuf_116[li_44] = 0;
   }
   return (0);
}

int MACDSignal(int ai_0) {
   double l_icustom_4 = iCustom(Symbol(), 0, "!SupportingMACD", 12, 26, 9, 0, ai_0);
   double l_icustom_12 = iCustom(Symbol(), 0, "!SupportingMACD", 12, 26, 9, 0, ai_0 + 1);
   double l_icustom_20 = iCustom(Symbol(), 0, "!SupportingMACD", 12, 26, 9, 1, ai_0);
   double l_icustom_28 = iCustom(Symbol(), 0, "!SupportingMACD", 12, 26, 9, 1, ai_0 + 1);
   if (l_icustom_4 > l_icustom_20 && l_icustom_12 <= l_icustom_28) return (1);
   if (l_icustom_4 < l_icustom_20 && l_icustom_12 >= l_icustom_28) return (1);
   return (0);
}

int ThreeBars(int ai_0) {
   int l_count_4 = 0;
   for (int l_count_8 = 0; l_count_8 < 16; l_count_8++)
      if (g_ibuf_112[ai_0 + l_count_8] != 0.0 || g_ibuf_128[ai_0 + l_count_8] != 0.0) l_count_4++;
   if (l_count_4 > 2) return (1);
   return (0);
}

void SendAlert(string as_0) {
   if (Time[1] != gi_172) {
      if (SoundAlert) {
         if (as_0 == "wb") Alert(Symbol() + " => TF: " + Period() + "M => " + TimeToStr(TimeCurrent()) + " white bar");
         if (as_0 == "wbmacd") Alert(Symbol() + " => TF: " + Period() + "M => " + TimeToStr(TimeCurrent()) + " white bar + macd");
         if (as_0 == "rb") Alert(Symbol() + " => TF: " + Period() + "M => " + TimeToStr(TimeCurrent()) + " red bar");
         if (as_0 == "tb") Alert(Symbol() + " => TF: " + Period() + "M => " + TimeToStr(TimeCurrent()) + " three bars");
         if (as_0 == "yb") Alert(Symbol() + " => TF: " + Period() + "M => " + TimeToStr(TimeCurrent()) + " whitebar + trendwave");
      }
      if (EmailAlert) {
         if (as_0 == "wb") SendMail("!SuperADX Alert", Symbol() + " => TF: " + Period() + "M => " + TimeToStr(TimeCurrent()) + " white bar");
         if (as_0 == "wbmacd") SendMail("!SuperADX Alert", Symbol() + " => TF: " + Period() + "M => " + TimeToStr(TimeCurrent()) + " white bar + macd");
         if (as_0 == "rb") SendMail("!SuperADX Alert", Symbol() + " => TF: " + Period() + "M => " + TimeToStr(TimeCurrent()) + " red bar");
         if (as_0 == "tb") SendMail("!SuperADX Alert", Symbol() + " => TF: " + Period() + "M => " + TimeToStr(TimeCurrent()) + " three bars");
         if (as_0 == "yb") SendMail("!SuperADX Alert", Symbol() + " => TF: " + Period() + "M => " + TimeToStr(TimeCurrent()) + " whitebar + trendwave");
      }
      gi_172 = Time[1];
   }
}

Комментарии к исходному коду форекс индикатора !SuperADX.mq4
В целях безопасности и борьбы со спамом в тексте комментариев запрещено размещать html-теги и ссылки. Благодарим за понимание.

  • X
  • 0% загружено
« индикатор !Retracement Finder.mq4
индикатор !SupportingADX.mq4 »