求大神帮修一下

楼主  收藏   举报   帖子创建时间:  2019-05-05 11:21 回复:0 关注量:922

#property copyright "Copyright ?2011, Leandro Farias (Dr. Alexander Elder AutoEnvelope based)"
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 White
#property indicator_color4 Yellow

extern int mme_periodo = 26;
extern int mme2_periodo = 13;
extern int stdev_periodo = 60;
extern int band_mme = 200;
int Gi_92;
int Gi_96;
int Gi_100;
double Gda_104[];
double Gda_108[];
double Gda_112[];
double Gda_116[];

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   SetIndexBuffer(0, Gda_104);
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexBuffer(1, Gda_108);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexBuffer(2, Gda_112);
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexBuffer(3, Gda_116);
   SetIndexStyle(3, DRAW_LINE, STYLE_SOLID, 2);
   f0_0("信息栏1", "AutoEnvelope 包络线与均线系统", 20, 20, 11, "微软雅黑", Yellow);
   f0_0("信息栏2", "======================================", 20, 35, 8, "Arial", White);
   f0_0("信息栏3", "买入信号区", 20, 50, 9, "Arial", DeepSkyBlue);
   f0_0("信息栏4", "---------------", 20, 60, 8, "Arial", White);
   f0_0("信息栏6", "======================================", 20, 135, 8, "Arial", White);
   f0_0("信息栏7", "卖出信号区", 20, 150, 9, "Arial", Orange);
   f0_0("信息栏8", "---------------", 20, 160, 8, "Arial", White);
   f0_0("信息栏10", "=====================================", 20, 235, 8, "Arial", White);
   f0_0("信息栏11", "交易规则-1", 20, 250, 9, "Arial", Pink);
   f0_0("信息栏12", "---------------", 20, 260, 8, "Arial", White);
   f0_0("信息栏13", "黄线上穿白线买入   黄线下穿白线卖出", 20, 275, 9, "Arial", DeepPink);
   f0_0("信息栏14", "上下包络线为止盈止损位", 20, 290, 9, "Arial", DeepPink);
   f0_0("信息栏15", "交易规则-2", 20, 310, 9, "Arial", Pink);
   f0_0("信息栏16", "---------------", 20, 320, 8, "Arial", White);
   f0_0("信息栏17", "当包络线倾斜度小于30度时(盘整时)", 20, 335, 9, "Arial", DeepPink);
   f0_0("信息栏18", "价格在红线则买入 在蓝线则卖出", 20, 350, 9, "Arial", DeepPink);
   f0_0("信息栏19", "其他", 20, 370, 9, "Arial", Pink);
   f0_0("信息栏20", "---------------", 20, 380, 8, "Arial", White);
   f0_0("信息栏21", "买卖时,交叉处与上或下包络线", 20, 395, 9, "Arial", DeepPink);
   f0_0("信息栏22", "的1、2、3倍有特殊关系", 20, 410, 9, "Arial", DeepPink);
   f0_0("信息栏23", "=====================================", 20, 425, 8, "Arial", White);
   return (0);
}

// 52D46093050F38C27267BCE42543EF60
int deinit() {
   ObjectsDeleteAll();
   return (0);
}

// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   double Ld_16;
   double Ld_24;
   double Ld_32;
   int Li_0 = IndicatorCounted();
   int Li_8 = 0;
   int Li_12 = Bars - mme_periodo;
   double Ld_40 = 2.0 / (band_mme + 1);
   int Li_4 = Li_12;
   while (Li_4 > -1) {
      Ld_16 = iStdDev(NULL, 0, stdev_periodo, 0, MODE_EMA, PRICE_CLOSE, Li_4);
      if (Li_8 == 0) Ld_32 = Ld_16;
      else Ld_32 = Ld_24;
      Ld_24 = Ld_16 * Ld_40 + Ld_32 * (1 - Ld_40);
      Gda_112[Li_4] = iMA(NULL, 0, mme_periodo, 0, MODE_EMA, PRICE_CLOSE, Li_4);
      if (mme2_periodo > 0) Gda_116[Li_4] = iMA(NULL, 0, mme2_periodo, 0, MODE_EMA, PRICE_CLOSE, Li_4);
      Gda_104[Li_4] = Gda_112[Li_4] * (Ld_24 / Gda_112[Li_4] + 1.0);
      Gda_108[Li_4] = Gda_112[Li_4] * (1 - Ld_24 / Gda_112[Li_4]);
      if (Gda_112[0] < Gda_116[0] && Gda_112[1] > Gda_116[1]) {
         Gi_92 = TimeCurrent();
         f0_0("信息栏5", "    买入!", 20, 75, 35, "微软雅黑", Aqua);
      }
      if (Gda_112[0] > Gda_116[0] && Gda_112[1] < Gda_116[1]) {
         Gi_92 = TimeCurrent();
         f0_0("信息栏9", "    卖出!", 20, 175, 35, "微软雅黑", Red);
      }
      Li_4--;
      Li_8++;
   }
   Gi_96 = TimeCurrent();
   Gi_100 = Gi_92 + 2;
   if (Gi_96 > Gi_100) {
      ObjectDelete("信息栏5");
      ObjectDelete("信息栏9");
   }
   return (0);
}

// AE96998A6603E29561325BEF9967C4B7
void f0_0(string As_0, string As_8, int Ai_16, int Ai_20, int Ai_24, string As_28, color Ai_36) {
   ObjectCreate(As_0, OBJ_LABEL, 0, 0, 0);
   ObjectSetText(As_0, As_8, Ai_24, As_28, Ai_36);
   ObjectSet(As_0, OBJPROP_XDISTANCE, Ai_16);
   ObjectSet(As_0, OBJPROP_YDISTANCE, Ai_20);
}


打赏