外汇指标
{求助}提醒不断重复
回复:0  浏览:987
  • 楼主admin 圈主
  • 2019-05-05 10:19


#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DeepPink
#property indicator_color2 DodgerBlue

double g_ibuf_76[];
double g_ibuf_80[];
extern bool Voicealert = FALSE;

int init() {
   ObjectCreate("June", OBJ_LABEL, 0, 0, 0);
   ObjectSet("June", OBJPROP_CORNER, 4);
   ObjectSet("June", OBJPROP_XDISTANCE, 0);
   ObjectSet("June", OBJPROP_YDISTANCE, 15);
   ObjectSet("June", OBJPROP_BACK, TRUE);
   ObjectSetText("June", "        ", 14, "Verdana", Lime);
   SetIndexStyle(0, DRAW_ARROW, EMPTY, 2);
   SetIndexArrow(0, 104);
   SetIndexBuffer(0, g_ibuf_76);
   SetIndexStyle(1, DRAW_ARROW, EMPTY, 2);
   SetIndexArrow(1, 104);
   SetIndexBuffer(1, g_ibuf_80);
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   int li_0;
   double l_ima_4;
   double l_ima_12;
   double l_ima_20;
   double l_ima_28;
   double l_ima_36;
   double l_ima_44;
   double l_ima_52;
   double l_ima_60;
   double ld_68;
   double ld_76;
   int li_84 = IndicatorCounted();
   if (li_84 < 0) return (-1);
   if (li_84 > 0) li_84--;
   int li_88 = Bars - li_84;
   for (int li_92 = 0; li_92 <= li_88; li_92++) {
      li_0 = li_92;
      ld_68 = 0;
      ld_76 = 0;
      for (li_0 = li_92; li_0 <= li_92 + 9; li_0++) ld_76 += MathAbs(High[li_0] - Low[li_0]);
      ld_68 = ld_76 / 10.0;
      l_ima_4 = iMA(NULL, 0, 14, 0, MODE_LWMA, PRICE_MEDIAN, li_92);
      l_ima_12 = iMA(NULL, 0, 55, 0, MODE_LWMA, PRICE_MEDIAN, li_92);
      l_ima_20 = iMA(NULL, 0, 1, 0, MODE_LWMA, PRICE_CLOSE, li_92);
      l_ima_36 = iMA(NULL, 0, 3, 0, MODE_LWMA, PRICE_CLOSE, li_92 + 1);
      l_ima_52 = iMA(NULL, 0, 3, 0, MODE_LWMA, PRICE_CLOSE, li_92 - 1);
      l_ima_28 = iMA(NULL, 0, 5, 0, MODE_LWMA, PRICE_OPEN, li_92);
      l_ima_44 = iMA(NULL, 0, 5, 0, MODE_LWMA, PRICE_OPEN, li_92 + 1);
      l_ima_60 = iMA(NULL, 0, 5, 0, MODE_LWMA, PRICE_OPEN, li_92 - 1);
      if ((High[li_92] + Low[li_92]) / 2.0 < l_ima_12 && (High[li_92] + Low[li_92]) / 2.0 < l_ima_4 && l_ima_20 > l_ima_28 && l_ima_36 < l_ima_44 && l_ima_52 > l_ima_60) {
         g_ibuf_76[li_92] = Low[li_92] - ld_68 / 2.0;
         if (Voicealert == TRUE) alert("Moving Average has crossed up");
      } else {
         if ((High[li_92] + Low[li_92]) / 2.0 > l_ima_12 && (High[li_92] + Low[li_92]) / 2.0 > l_ima_4 && l_ima_20 < l_ima_28 && l_ima_36 > l_ima_44 && l_ima_52 < l_ima_60) {
            g_ibuf_80[li_92] = High[li_92] + ld_68 / 2.0;
            if (Voicealert == TRUE) alert("Moving Average has crossed down");
         }
      }
   }
   return (0);
}

提醒按钮开了就无限提醒,为什么这样啊