女人花如梦 发表于 2011-11-8 04:21:38

呼叫版主变色均线加入MACD条件指标,该怎么实现?

希望实现的是,当价格在18日均线上方且macd>0时,18日均线为红色,如果不加入MACD条件均线可以实现红绿变色,但是加入MACD条件后均线全为绿色,
以下是我的指标,望高手指点,哪里出了错误?谢谢




#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Green
extern int变色均线=18;
double duo[];
double kong[];
double macd11[];
int init()
    {
   SetIndexBuffer(0,duo);
   SetIndexBuffer(1,kong);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(0,变色均线);
   SetIndexDrawBegin(1,变色均线);
   IndicatorDigits(Digits);
   return(0);
    }
int start()
    {
   double temp0,temp1;
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars0) counted_bars--;
   limit=Bars-counted_bars;
      for(int i=0; i=0; i--)
      {   
      duo<i>=EMPTY_VALUE;
      kong<i>=EMPTY_VALUE;
      temp0=iMA(NULL,0,变色均线,0,MODE_SMA,PRICE_CLOSE,i);
      temp1=iMA(NULL,0,变色均线,0,MODE_SMA,PRICE_CLOSE,i+1);
      if(iClose(NULL,0,i)>=iMA(NULL,0,变色均线,0,MODE_SMA,PRICE_CLOSE,i)&&macd11<i>>0)
            {duo<i>=temp0; duo=temp1;}
      else{kong<i>=temp0; kong=temp1;}
      }      
   return(0);
    }

xiaodong 发表于 2012-11-22 02:18:00

好困啊

oxp 发表于 2012-11-22 02:18:00

这个贴不错!!!!!

bjsam68 发表于 2012-11-22 02:18:00

(*^__^*) 嘻嘻……   

ea流氓 发表于 2012-11-22 02:18:00

真的有么

后山俗人 发表于 2012-11-22 02:18:00

顶下再看

香港第一金 发表于 2012-11-22 02:18:00

必须顶

wilf528 发表于 2012-11-22 02:18:00

抢座位来了

悟空小宝 发表于 2012-11-22 02:18:00

支持你就顶你

好久不见 发表于 2012-11-22 02:18:00

好帖,有才
页: [1] 2
查看完整版本: 呼叫版主变色均线加入MACD条件指标,该怎么实现?