Navigation:Home > Content >

VininI_HMA~.mq4

Time: 2013-02-12 | Download file:VininI_HMA~.mq4

/*
   Generated by EX4-TO-MQ4 decompiler V4.0.223.1c []
   Website: http://purebeam.biz
   E-mail : [email protected]
*/
#property copyright "MT4 release WizardSerg , ?? ??????? ForexMagazine #104"
#property link      "[email protected]"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 Aqua
#property indicator_color3 Red

extern int period = 23;
extern int method = 3;
extern int price = 0;
extern int sdvig = 0;
double g_ibuf_92[];
double g_ibuf_96[];
double g_ibuf_100[];
double g_ibuf_104[];

int init() {
   IndicatorBuffers(4);
   SetIndexBuffer(0, g_ibuf_100);
   SetIndexBuffer(1, g_ibuf_92);
   SetIndexBuffer(2, g_ibuf_96);
   SetIndexBuffer(3, g_ibuf_104);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexStyle(2, DRAW_LINE);
   SetIndexDrawBegin(0, 1 * period);
   SetIndexDrawBegin(1, period * 2);
   SetIndexDrawBegin(2, 3 * period);
   IndicatorShortName("Signal Line(" + period + ")");
   SetIndexLabel(1, "UP");
   SetIndexLabel(2, "DN");
   return (0);
}

int deinit() {
   return (0);
}

double WMA(int ai_0, int a_period_4) {
   return (iMA(NULL, 0, a_period_4, 0, method, price, ai_0 + sdvig));
}

int start() {
   int li_0 = IndicatorCounted();
   if (li_0 < 0) return (-1);
   if (li_0 > 0) li_0--;
   int l_period_4 = MathSqrt(period);
   int li_20 = Bars - li_0;
   int li_16 = li_20;
   int li_12 = li_16;
   if (li_0 == 0) {
      li_16 -= period;
      li_20 -= period * 2;
   }
   for (int li_8 = li_12; li_8 >= 0; li_8--) g_ibuf_104[li_8] = 2.0 * WMA(li_8, period / 2) - WMA(li_8, period);
   for (li_8 = li_16; li_8 >= 0; li_8--) g_ibuf_100[li_8] = iMAOnArray(g_ibuf_104, 0, l_period_4, 0, method, li_8);
   for (li_8 = li_20; li_8 >= 0; li_8--) {
      g_ibuf_92[li_8] = EMPTY_VALUE;
      if (g_ibuf_100[li_8] > g_ibuf_100[li_8 + 1]) g_ibuf_92[li_8] = g_ibuf_100[li_8];
      g_ibuf_96[li_8] = EMPTY_VALUE;
      if (g_ibuf_100[li_8] < g_ibuf_100[li_8 + 1]) g_ibuf_96[li_8] = g_ibuf_100[li_8];
   }
   return (0);
}

Recommend