感谢牛老大,编了个彩色macd

楼主  收藏   举报   帖子创建时间:  2019-05-05 14:47 回复:0 关注量:938
#property indicator_buffers 7
  #property indicator_separate_window
  #property indicator_color1 Yellow//可以没有?
  #property indicator_color2 Silver
  #property indicator_color3 White
  #property indicator_color4 Green
  #property indicator_color5 Red
  #property indicator_color6 Red
  double Buffer1[];
  double Buffer2[];
  double Buffer3[];
  double Buffer上[];
  double Buffer下[];
  double Buffer6[];
  extern int Fast=12;
  extern int Slow=26;
  extern int Signal=9;
  int init()
    {
     SetIndexStyle(0,DRAW_LINE,0,1);
     SetIndexStyle(1,DRAW_LINE,0,1);
     SetIndexStyle(2,DRAW_HISTOGRAM,0,1);//可以没有?
     SetIndexStyle(3,DRAW_HISTOGRAM,0,2);
     SetIndexBuffer(0,Buffer1);
     SetIndexBuffer(1,Buffer2);
     SetIndexBuffer(2,Buffer3);//存放数据,必须的
     SetIndexBuffer(3,Buffer上);
     SetIndexBuffer(4,Buffer下);
     SetIndexStyle(4,DRAW_HISTOGRAM,0,2);
     SetIndexBuffer(5,Buffer6);
     SetIndexStyle(5,DRAW_LINE,0,2);
     IndicatorShortName("MACD("+Fast+","+Slow+","+Signal+")");
     SetIndexLabel(0,"MACD_MAIN");
     SetIndexLabel(1,"MACD_SIGNAL");
     SetIndexLabel(2,"MAIN-SIGNAL");
     IndicatorDigits(Digits+2);
     return(0);
    }
  int deinit()
  {
  return(0);
  }
  int start()
    {
     int limit,counted_bars=IndicatorCounted();
     if(counted_bars0) counted_bars--;
     limit=Bars-counted_bars;
     for(int i=0; iBuffer1[i+1])  Buffer6[i]=Buffer1[i];
        }
     return(0);
    }
打赏