//+------------------------------------------------------------------+ //| Accel_MA_v1_02.mq5 | //| Accelarated Moving Average v1.03 Copyright 2015, fxborg | //| http://fxborg-labo.hateblo.jp/ | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, fxborg" #property link "http://fxborg-labo.hateblo.jp/" #property version "1.03" #property indicator_buffers 9 #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 AccelPeriod= int(InpK*20); double alpha=MathMax(0.001,MathMin(1,InpK)); double AtrAlpha = 0.99; //---- will be used as indicator buffers double ATR[]; 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; 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,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); } //+------------------------------------------------------------------+