求助:将成交量引入MACD。

楼主  收藏   举报   帖子创建时间:  2019-05-05 15:21 回复:0 关注量:96
如何将成交量引入双线MACD公式啊。
  求高手指点!
  
  //---- indicator settings
  #property  indicator_separate_window
  #property  indicator_buffers 4
  #property  indicator_color1  Blue
  #property  indicator_color2  Red
  #property  indicator_color3  Red
  #property  indicator_color4  Green
  //int indicator_color3;
  //---- indicator parameters
  extern int FastEMA=12;
  extern int SlowEMA=26;
  extern int SignalEMA=9;
  //---- indicator buffers
  double     ind_buffer1[];
  double     ind_buffer2[];
  double     ind_buffer3[];
  double     ind_buffer4[];
  double     temp;
  
  //+------------------------------------------------------------------+
  //| Custom indicator initialization function                         |
  //+------------------------------------------------------------------+
  int init()
    {
  //---- drawing settings
     SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
     SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
     SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,1);
     SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,1);
     SetIndexDrawBegin(1,SignalEMA);
     IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
  //---- indicator buffers mapping
     if(!SetIndexBuffer(0,ind_buffer1) && !SetIndexBuffer(1,ind_buffer2)&& !SetIndexBuffer(2,ind_buffer3)&& !SetIndexBuffer(3,ind_buffer4))
        Print("cannot set indicator buffers!");
  //---- name for DataWindow and indicator subwindow label
     IndicatorShortName("MACDVOL("+FastEMA+","+SlowEMA+","+SignalEMA+")");
     SetIndexLabel(0,"MACDVOL");
     SetIndexLabel(1,"Signal");
  //---- initialization done
     return(0);
    }
  //+------------------------------------------------------------------+
  //| Moving Averages Convergence/Divergence                           |
  //+------------------------------------------------------------------+
  int start()
    {
     int limit;
     int counted_bars=IndicatorCounted();
  //---- check for possible errors
     if(counted_bars0) counted_bars--;
     limit=Bars-counted_bars;
  //---- macd counted in the 1-st buffer
     for(int i=0; i
打赏