诚信为本
量力而为
当前位置:峰汇在线 > MetaTrader 4 > MT4指标 > 正文

之字形通道拐点提示 DT_ZigZag.mq4

DT_ZigZag 指标提示之字形通道的拐点。

图表:DT_ZigZag 指标

源码:

//+------------------------------------------------------------------+ 
//|                                                     DT_ZigZag.mq4| 
//+------------------------------------------------------------------+ 
#property copyright "klot" 
#property link      "http://www.125808047.com"

#property indicator_chart_window 
#property indicator_buffers 1 
#property indicator_color1 Yellow 

extern int GrossPeriod=60; 
extern int ExtDepth=12; 
extern int ExtDeviation=5; 
extern int ExtBackstep=3; 

double ExtMapBuffer1[]; 
datetime daytimes[]; 
//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int OnInit(void)
{
   SetIndexStyle(0,DRAW_ARROW); 
   SetIndexArrow(0,159); 
   SetIndexBuffer(0,ExtMapBuffer1); 
   SetIndexEmptyValue(0,0.0); 
   
   ArrayCopySeries(daytimes,MODE_TIME,Symbol(),GrossPeriod); 
   Comment("www.125808047.com");
   return(INIT_SUCCEEDED);
} 
//+------------------------------------------------------------------+ 
//| Custom indicator iteration function                              | 
//+------------------------------------------------------------------+ 
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   int    limit, bigshift; 
   int    counted_bars=IndicatorCounted(); 
   if (counted_bars<0) return(-1); 
    
   if (counted_bars>0) counted_bars--; 
    
   limit=Bars-counted_bars; 
    
   for (int i=0; i<limit; i++) 
   { 
   if(Time[i]>=daytimes[0]) bigshift=0; 
   else 
     { 
      bigshift = ArrayBsearch(daytimes,Time[i-1],WHOLE_ARRAY,0,MODE_DESCEND); 
      if(Period()<=GrossPeriod) bigshift++; 
     } 
  ExtMapBuffer1[i]=iCustom(NULL,GrossPeriod,"ZigZag",ExtDepth,ExtDeviation,ExtBackstep,0,bigshift); 
   } 
   return(rates_total); 
  } 
//+------------------------------------------------------------------+ 
打赏
版权所有转载请注明标题及链接:峰汇在线 » 之字形通道拐点提示 DT_ZigZag.mq4
上一篇:
下一篇:
分享到: 更多 (0)

如您觉得此文不错请扫码打赏!

支付宝扫一扫打赏

微信扫一扫打赏