ak47fx 发表于 2011-9-12 17:37:44

求大大帮忙改下MACD指标

这个指标是三色的,帮忙改下,可以穿越0轴报警,谢谢了

#property copyright \"GOLDEN \"
#property link      \"1 \"

#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 DarkGray
#property indicator_color2 Blue
#property indicator_color3 Red
#property indicator_color4 Lime


extern int FastEMA = 12;
extern int SlowEMA = 26;
extern int SignalSMA = 9;
double g_ibuf_88[];
double g_ibuf_92[];
double g_ibuf_96[];
double g_ibuf_100[];
double g_ibuf_104[];
int gi_unused_108 = 0;

int init() {
   IndicatorBuffers(5);
   SetIndexStyle(0, DRAW_HISTOGRAM);
   SetIndexStyle(1, DRAW_HISTOGRAM);
   SetIndexStyle(2, DRAW_HISTOGRAM);
   SetIndexStyle(3, DRAW_LINE);
   SetIndexStyle(4, DRAW_NONE);
   IndicatorDigits(Digits + 1);
   SetIndexBuffer(0, g_ibuf_88);
   SetIndexBuffer(1, g_ibuf_92);
   SetIndexBuffer(2, g_ibuf_96);
   SetIndexBuffer(3, g_ibuf_100);
   SetIndexBuffer(4, g_ibuf_104);
   IndicatorShortName(\"Golden MACD(\" + FastEMA + \",\" + SlowEMA + \",\" + SignalSMA + \")\");
   SetIndexLabel(0, \"MACD\");
   SetIndexLabel(1, \"MACD\");
   SetIndexLabel(2, \"MACD\");
   SetIndexLabel(3, \"Signal\");
   return (0);
}

int start() {
   int li_4 = IndicatorCounted();
   if (li_4 > 0) li_4--;
   int li_0 = Bars - li_4;
   for (int li_8 = 0; li_8 < li_0; li_8++) g_ibuf_104 = iMA(NULL, 0, FastEMA, 0, MODE_EMA, PRICE_CLOSE, li_8) - iMA(NULL, 0, SlowEMA, 0, MODE_EMA, PRICE_CLOSE, li_8);
   for (li_8 = 0; li_8 < li_0; li_8++) g_ibuf_100 = iMAOnArray(g_ibuf_104, Bars, SignalSMA, 0, MODE_SMA, li_8);
   for (li_8 = 0; li_8 < li_0; li_8++) {
      if (g_ibuf_104 > 0.0 && g_ibuf_104 >= g_ibuf_100) {
         g_ibuf_92 = g_ibuf_104;
         g_ibuf_96 = 0;
         g_ibuf_88 = 0;
         
      }
      if (g_ibuf_104 < 0.0 && g_ibuf_1040.0 && g_ibuf_104 < g_ibuf_100) || (g_ibuf_104 < 0.0 && g_ibuf_104 > g_ibuf_100)) {
         g_ibuf_88 = g_ibuf_104;
         g_ibuf_92 = 0;
         g_ibuf_96 = 0;
      }
   }
   return (0);
}

l26709020 发表于 2012-11-25 16:59:05

这贴子你会收藏吗

抓耗子 发表于 2012-11-25 16:59:05

这个不可信,没有保险的保赚钱的软件   

wenken123 发表于 2012-11-25 18:27:51

晕死也不多加点分

pop 发表于 2012-11-25 18:27:51

呵呵,找个机会...

dmpdc 发表于 2012-11-25 18:27:51

就为赚分嘛

汇眼识金 发表于 2012-11-25 18:27:51

似曾相识的感觉

gp123456789 发表于 2012-11-25 18:27:51

楼主有没有好的EA推荐

fuckqq 发表于 2012-11-25 18:27:51

资金量设置的是10000美元啊,

黄金蛙 发表于 2014-11-29 19:14:14

看看怎么样
页: [1] 2
查看完整版本: 求大大帮忙改下MACD指标