//+------------------------------------------------------------------+ //| Alma_Stochastic_v1_00.mq5 | //| ALMA by Arnaud Legoux / Dimitris Kouzis-Loukas / Anthony Cascino | //| www.arnaudlegoux.com | //| Alma Stochastic v1.00 Written BY 2016, fxborg | //| http://fxborg-labo.hateblo.jp/ | //+------------------------------------------------------------------+ #property copyright "Copyright 2016, fxborg" #property link "http://fxborg-labo.hateblo.jp/" #property version "1.00" #property indicator_buffers 10 #property indicator_plots 1 #property indicator_separate_window #property indicator_minimum -0 #property indicator_maximum 100 #property indicator_level1 75 #property indicator_level2 25 #property indicator_type1 DRAW_COLOR_LINE #property indicator_color1 clrDodgerBlue ,clrSilver,clrRed #property indicator_width1 2 //--- input parameters input int InpKPeriod=8; // K period input int InpSlowing=3; // Slowing input int InpThreshold=5; //Threshold input int InpLength = 9; //Window Size input double InpSigma = 6.0; //Sigma parameter input double InpOffset = 0.85; //Offset of Gaussian distribution (0...1) // alpha double Alpha=2.0/(1.0+InpKPeriod); //---- will be used as indicator buffers double OSC[]; double SOSC[]; double HI[]; double LO[]; double POS[]; double RANGE[]; double MAIN[]; double MA[]; double SIG[]; double MOM[]; double VOLAT[]; double Accel[]; //---- declaration of global variables double W[]; int min_rates_total=InpKPeriod+1; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //---- Initialization of variables of data calculation starting point //--- indicator buffers mapping SetIndexBuffer(0,MAIN,INDICATOR_DATA); SetIndexBuffer(1,SIG,INDICATOR_COLOR_INDEX); SetIndexBuffer(2,SOSC,INDICATOR_DATA); SetIndexBuffer(3,MA,INDICATOR_CALCULATIONS); SetIndexBuffer(4,HI,INDICATOR_CALCULATIONS); SetIndexBuffer(5,LO,INDICATOR_CALCULATIONS); SetIndexBuffer(6,MOM,INDICATOR_CALCULATIONS); SetIndexBuffer(7,POS,INDICATOR_CALCULATIONS); SetIndexBuffer(8,RANGE,INDICATOR_CALCULATIONS); SetIndexBuffer(9,OSC,INDICATOR_CALCULATIONS); //--- ArrayResize(W,InpLength); double m = MathFloor(InpOffset*(InpLength - 1)); double s = InpLength/InpSigma; double wSum=0; for(int i=0;iSOSC[i])MAIN[i]=SOSC[i]; else MAIN[i]=MAIN[i-1]; //--- if(i<=i3rd+1) continue; //--- if(MAIN[i]>MAIN[i-1])SIG[i]=0; else if(MAIN[i]