//+------------------------------------------------------------------+ //| HP.mq4 | //+------------------------------------------------------------------+ #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 Yellow //Global constants #define pi 3.141592653589793238462643383279502884197169399375105820974944592 //Input parameters extern int nobs =1000; //Number of bars to smooth extern int FiltPer =12; //Equivalent to SMA period //Indicator buffers double hpf[],lambda; int init() { lambda=0.0625/MathPow(MathSin(pi/FiltPer),4); SetIndexBuffer(0,hpf); SetIndexStyle(0,DRAW_LINE); return(0); } //+----------------------------------------------------------------------------------------+ int start() { double x[]; ArrayResize(x,nobs); if (ArraySize(hpf)=0;i--) { y[i]=a[i]-b[i]*H1-c[i]*H2; H2=H1; H1=y[i]; } }