Navigation´╝ÜHome > Content >

BR16.mq4

Time: 2010-12-22 | Download file:BR16.mq4

#property copyright "Boss"
#property link      "Ustas"

#property indicator_separate_window
#property indicator_minimum -1.1
#property indicator_maximum 1.1
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red

extern int period = 25;
extern int limit = 5000;
double g_ibuf_84[];
double g_ibuf_88[];
double g_ibuf_92[];

int init() {
   IndicatorBuffers(3);
   SetIndexStyle(0, DRAW_ARROW);
   SetIndexStyle(1, DRAW_ARROW);
   SetIndexStyle(2, DRAW_NONE);
   SetIndexEmptyValue(0, 0.0);
   SetIndexEmptyValue(1, 0.0);
   SetIndexArrow(0, 233);
   SetIndexArrow(1, 234);
   SetIndexBuffer(0, g_ibuf_88);
   SetIndexBuffer(1, g_ibuf_92);
   SetIndexBuffer(2, g_ibuf_84);
   IndicatorShortName("BR16");
   return (0);
}

int start() {
   double ld_72;
   double ld_24 = 0;
   double ld_32 = 0;
   double ld_unused_40 = 0;
   double ld_unused_48 = 0;
   double ld_56 = 0;
   double ld_unused_64 = 0;
   double l_low_80 = 0;
   double l_high_88 = 0;
   for (int li_96 = 0; li_96 <= limit; li_96++) {
      g_ibuf_88[li_96] = 0;
      g_ibuf_92[li_96] = 0;
   }
   for (li_96 = 0; li_96 <= limit; li_96++) {
      l_high_88 = High[iHighest(NULL, 0, MODE_HIGH, period, li_96)];
      l_low_80 = Low[iLowest(NULL, 0, MODE_LOW, period, li_96)];
      ld_72 = (High[li_96] + Low[li_96]) / 2.0;
      if (l_high_88 != l_low_80) ld_24 = 0.66 * ((ld_72 - l_low_80) / (l_high_88 - l_low_80) - 0.5) + 0.67 * ld_32;
      else ld_24 = 0.0;
      ld_24 = MathMin(MathMax(ld_24, -0.999), 0.999);
      g_ibuf_84[li_96] = MathLog((ld_24 + 1.0) / (1 - ld_24)) / 2.0 + ld_56 / 2.0;
      ld_32 = ld_24;
      ld_56 = g_ibuf_84[li_96];
   }
   for (li_96 = 0; li_96 <= limit; li_96++) {
      if (g_ibuf_84[li_96] >= 0.0 && g_ibuf_84[li_96 + 1] < 0.0) g_ibuf_88[li_96] = -1;
      if (g_ibuf_84[li_96] <= 0.0 && g_ibuf_84[li_96 + 1] > 0.0) g_ibuf_92[li_96] = 1;
   }
   return (0);
}

Recommend