//+------------------------------------------------------------------+ //| Accel_MA_v1_02.mq5 | //| Accelarated Moving Average v1.02 Copyright 2015, fxborg | //| http://fxborg-labo.hateblo.jp/ | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, fxborg" #property link "http://fxborg-labo.hateblo.jp/" #property version "1.02" #property indicator_buffers 8 #property indicator_plots 1 #property indicator_chart_window #property indicator_type1 DRAW_COLOR_LINE #property indicator_color1 clrDodgerBlue,clrWhiteSmoke,clrRed #property indicator_width1 2 #property indicator_type2 DRAW_LINE #property indicator_color2 clrDodgerBlue #property indicator_width2 2 //--- input parameters input double InpK=0.4; // K input int InpPeriod=20; // Period input int InpSmoothing=14; // Smoothing double InpThreshhold=0.04; // Threshhold int InpAtrSmoothing=100; // ATR Smoothing int AccelPeriod= int(InpK*15); double alpha=MathMax(0.001,MathMin(1,InpK)); double BinRange=(MathSqrt(PeriodSeconds())*0.25)*_Point; double ZoomRate=NormalizeDouble(100/BinRange,1); //---- will be used as indicator buffers double ATR[]; double TR1[]; double TR2[]; double MAIN[]; double MA1[]; double SIG[]; double MOM[]; double VOLAT[]; double Accel[]; //---- declaration of global variables // SuperSmoother Filter double SQ2=sqrt(2); double A1 = MathExp( -SQ2 * M_PI / InpSmoothing ); double B1 = 2 * A1 * MathCos( SQ2 *M_PI / InpSmoothing ); double C2 = B1; double C3 = -A1 * A1; double C1 = 1 - C2 - C3; // SuperSmoother Filter double _A1 = MathExp( -SQ2 * M_PI / InpAtrSmoothing ); double _B1 = 2 * _A1 * MathCos( SQ2 *M_PI / InpAtrSmoothing ); double _C2 = _B1; double _C3 = -_A1 * _A1; double _C1 = 1 - _C2 - _C3; int min_rates_total; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //---- Initialization of variables of data calculation starting point min_rates_total=2; //--- indicator buffers mapping //--- indicator buffers SetIndexBuffer(0,MAIN,INDICATOR_DATA); SetIndexBuffer(1,SIG,INDICATOR_COLOR_INDEX); SetIndexBuffer(2,MA1,INDICATOR_DATA); SetIndexBuffer(3,MOM,INDICATOR_DATA); SetIndexBuffer(4,VOLAT,INDICATOR_DATA); SetIndexBuffer(5,TR1,INDICATOR_DATA); SetIndexBuffer(6,TR2,INDICATOR_DATA); SetIndexBuffer(7,ATR,INDICATOR_DATA); //--- ArrayResize(Accel,AccelPeriod); for(int j=0;jdmax)dmax=dsum; if(dsum0)SIG[i]=0; else if (slope<0)SIG[i]=2; else SIG[i]=SIG[i-1]; } //---- return(rates_total); } //+------------------------------------------------------------------+