有您的持续关注
我们会做得更好

绘制类似通道的斐波那契指标



TDFibo指标简洁的在图表上绘制斐波那契,类似于通道,很是方便的参考行情波动及回撤区间。

TDFibo指标图表效果如下:斐波那契指标

TDFibo指标源码如下:

//+------------------------------------------------------------------+
//|                                                       TDFibo.mq4 |
//|                                     Copyright 2016, QQ:125808047 |
//+------------------------------------------------------------------+
#property copyright "www.125808047.com"
#property link      "http://www.125808047.com/"

#property  indicator_chart_window
#property  indicator_buffers 4
#property  indicator_color1  Silver
#property  indicator_color2  White
#property  indicator_color3  Red
#property  indicator_color4  Pink

extern int count=200;

double     HighBuffer[];
double     LowBuffer[];
double     MedianBuffer[];
double     Fib618[];

int init()
  {IndicatorBuffers(5);
   SetIndexBuffer(0,HighBuffer);
   SetIndexBuffer(1,MedianBuffer);   
   SetIndexBuffer(2,LowBuffer);
   SetIndexBuffer(3,Fib618);

   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);   
   SetIndexStyle(3,DRAW_LINE);   

   SetIndexLabel(0,"High"+count);
   SetIndexLabel(1,"Median"+count);   
   SetIndexLabel(2,"Low"+count);
   SetIndexLabel(3,"61.8");

   string shortname="斐波那契";
   IndicatorShortName(shortname);
   IndicatorDigits(Digits);

   return(0);
  }


int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   for(int i=0; i<limit; i++)
   {
     HighBuffer[i]=High[iHighest(NULL,0,MODE_HIGH,count,i)];
     LowBuffer[i]=Low[iLowest(NULL,0,MODE_LOW,count,i)];
     MedianBuffer[i]=(HighBuffer[i]+LowBuffer[i])/2;
     Fib618[i]=HighBuffer[i]-(HighBuffer[i]-LowBuffer[i])*0.618;
   }
   return(0);
  }

如您喜欢此文章请点下面分享按钮↴峰汇在线 » 绘制类似通道的斐波那契指标
上一篇:
下一篇:
分享到:更多 ()