多空均线-方子 发表于 2015-3-3 23:39:49

求职macd代码修改

各位大神,如下的macd代码有个问题就是总有好多的竖着的虚线,把图缩小起来之后特别的多,请各位帮忙,是否可以给修改掉,其他的保持不变,十分感谢。


#propertycopyright ""
#propertylink      ""
//---- indicator settings
#propertyindicator_separate_window
#propertyindicator_buffers 3
#propertyindicator_color1Gold
#propertyindicator_color2Red
#propertyindicator_color3Gray
#propertyindicator_width12
//---- indicator parameters
extern int FastEMA=20;
extern int SlowEMA=60;
extern int SignalSMA=5;
//---- indicator buffers
double   MacdBuffer[];
double   SignalBuffer[];
double   HistogramBuffer[];
//---- globals
int      maxLines;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   //
   SetIndexBuffer(0,MacdBuffer);
   SetIndexBuffer(1,SignalBuffer);
   SetIndexBuffer(2,HistogramBuffer);
   //
   SetIndexLabel(0,"MACD");
   SetIndexLabel(1,"Signal");
   SetIndexLabel(2,"MACD-Signal");
   //
   SetIndexDrawBegin(1,SignalSMA);
   IndicatorDigits(Digits+1);
   IndicatorShortName("MACD("+FastEMA+","+SlowEMA+","+SignalSMA+")");
   return(0);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
{
   DeleteLines();
   return(0);
}
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int start()
{
   double crossing;
   int limit,i;
   int counted_bars=IndicatorCounted();
//----
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//----
   for(i=0; i<limit; i++) MacdBuffer=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
   for(i=0; i<limit; i++)
   {
      SignalBuffer=iMAOnArray(MacdBuffer,Bars,SignalSMA,0,MODE_SMA,i);
      HistogramBuffer=MacdBuffer - SignalBuffer;
   }
//----
   DeleteLines();
   for(i=WindowBarsPerChart(); i>0 ;i--)
   {
      crossing=(MacdBuffer-SignalBuffer)*(MacdBuffer-SignalBuffer);
      if (crossing < 0)
      {
         maxLines+=1;
         ObjectCreate("MacdCross"+maxLines,0,0,Time,0);
         ObjectSet("MacdCross"+maxLines,OBJPROP_COLOR,DimGray);
         ObjectSet("MacdCross"+maxLines,OBJPROP_STYLE,STYLE_DOT);
      }
   }
   return(0);
}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void DeleteLines()
{
   for(int i=1;i<=maxLines;i++) ObjectDelete("MacdCross"+i); maxLines=0;
}
//+------------------------------------------------------------------+

多空均线-方子 发表于 2015-3-5 00:40:21

都没人帮忙修改一下嘛~
页: [1]
查看完整版本: 求职macd代码修改