诚信为本
量力而为
当前位置:首页MetaTrader 4MT4指标CyAn_2_High Pass Filter.mq4

CyAn_2_High Pass Filter.mq4

CyAn_2_High Pass Filter指标副图绘制特定的价格摆动线。

图表:CyAn_2_High Pass Filter指标

源码:

//+------------------------------------------------------------------+
//|                                      CyAn_2_High Pass Filter.mq4 |
//|                          Copyright @2005, Luis Guilherme Damiani |
//+------------------------------------------------------------------+
#property copyright "Copyright @2005, Luis Guilherme Damiani"
#property link      "http://www.125808047.com/"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Lime

extern double       alpha=0.5;
extern int       maxbars=2000;

double soHPF[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit(void)
{
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,soHPF);

   ArrayInitialize(soHPF,0);
   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    counted_bars=IndicatorCounted();

      if(counted_bars<0) return(-1);
      int limit=Bars-counted_bars;
      if(limit>maxbars)limit=maxbars;      
      for (int shift = limit; shift>=0;shift--)

      {
	      soHPF[shift]=MathPow(1-alpha/2,2)*(Close[shift] -2*Close[shift+1]+Close[shift+2])+2*(1-alpha)
	      *soHPF[shift+1]-MathPow(1-alpha,2)*soHPF[shift+2];
       }
  return(rates_total);
  }
版权所有转载请注明标题及链接:峰汇在线 » CyAn_2_High Pass Filter.mq4
上一篇:
下一篇:
分享到: 更多 (0)