Navigation:Home > Content >

11-10-PI_bg.mq4

Time: 2014-04-07 | Download file:11-10-PI_bg.mq4

#property copyright "ООО Partner-Invest Russia"
#property link      "foli@ipn.ru"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 DarkSlateGray
#property indicator_color3 SaddleBrown

extern string prpoduct = "Разработка ООО Партнер-Инвест";
extern string adr = "partner-invest@dsn.ru";
extern string ver = "v.02 2006 нябрь";
extern int period = 60;
extern double fl = 0.1;
double Gd_112 = 0.03;
double Gd_120 = 2.0;
double Gd_128 = 0.67;
double Gd_136 = 0.2;
double G_ibuf_144[];
double G_ibuf_148[];
double G_ibuf_152[];

int init() {
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 3);
   SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 3);
   IndicatorDigits(Digits + 1);
   SetIndexBuffer(0, G_ibuf_144);
   SetIndexBuffer(1, G_ibuf_148);
   SetIndexBuffer(2, G_ibuf_152);
   IndicatorShortName("Баланс длинных");
   SetIndexLabel(1, NULL);
   SetIndexLabel(2, NULL);
   return (0);
}

int start() {
   double Ld_0;
   double Ld_8;
   double Ld_16;
   int Li_24 = 0;
   double Ld_28 = 0;
   double Ld_36 = 0;
   double Ld_44 = 0;
   double low_52 = 0;
   double high_60 = 0;
   if (Li_24 > 0) Li_24--;
   int Li_68 = Bars - 1;
   for (int Li_72 = Li_24; Li_72 < Li_68; Li_72++) {
      high_60 = High[iHighest(NULL, 0, MODE_HIGH, period, Li_72)];
      low_52 = Low[iLowest(NULL, 0, MODE_LOW, period, Li_72)];
      Ld_16 = (High[Li_72] + Low[Li_72]) / 2.0;
      Ld_28 = Gd_112 * Gd_120 * ((Ld_16 - low_52) / (high_60 - low_52) - 0.5) + Gd_128 * Ld_36;
      Ld_28 = MathMin(MathMax(Ld_28, -0.999), 0.999);
      G_ibuf_144[Li_72] = Gd_136 * MathLog((Ld_28 + 1.0) / (1 - Ld_28)) + fl * Ld_44;
      Ld_36 = Ld_28;
      Ld_44 = G_ibuf_144[Li_72];
   }
   bool Li_76 = TRUE;
   for (Li_72 = Li_68 - 2; Li_72 >= 0; Li_72--) {
      Ld_8 = G_ibuf_144[Li_72];
      Ld_0 = G_ibuf_144[Li_72];
      if ((Ld_8 < 0.0 && Ld_0 > 0.0) || Ld_8 < 0.0) Li_76 = FALSE;
      if ((Ld_8 > 0.0 && Ld_0 < 0.0) || Ld_8 > 0.0) Li_76 = TRUE;
      if (!Li_76) {
         G_ibuf_152[Li_72] = Ld_0;
         G_ibuf_148[Li_72] = 0.0;
      } else {
         G_ibuf_148[Li_72] = Ld_0;
         G_ibuf_152[Li_72] = 0.0;
      }
   }
   return (0);
}

Recommend