//+------------------------------------------------------------------+ //| Interpolation.mq4 | //| Copyright © 2008, Gryb Alexander | //| ICQ: 478-923-832 E-mail: alexandergrib@rambler.ru | //+------------------------------------------------------------------+ #property copyright "Copyright © 2008, Gryb Alexander" #property link "ICQ: 478-923-832 E-mail: alexandergrib@rambler.ru" //---- indicator version number #property version "1.00" //---- drawing indicator in a separate window #property indicator_separate_window //---- number of indicator buffers 1 #property indicator_buffers 1 //---- only one plot is used #property indicator_plots 1 //+----------------------------------------------+ //| Indicator drawing parameters | //+----------------------------------------------+ //---- drawing the indicator as a line #property indicator_type1 DRAW_LINE //---- magenta color is used #property indicator_color1 clrMagenta //---- indicator line is a solid one #property indicator_style1 STYLE_SOLID //---- Indicator line width is equal to 2 #property indicator_width1 2 //---- displaying the indicator label #property indicator_label1 "Interpolation" //+----------------------------------------------+ //| declaring constants | //+----------------------------------------------+ #define RESET 0 // The constant for getting the command for the indicator recalculation back to the terminal //+----------------------------------------------+ //| INDICATOR INPUT PARAMETERS | //+----------------------------------------------+ input uint inumPrognoz=2; // Number of predicted bars input uint ibegin=0; // Starting bar for the analysis input uint iend=5; // Last bar for the analysis //+----------------------------------------------+ double b[]; //---- Declaration of integer variables of data starting point int min_rates_total,Shift,begin,end,numPrognoz; //---- declaration of dynamic arrays that will further be // used as indicator buffers double IndBuffer[]; //+------------------------------------------------------------------+ //| Interpolation indicator initialization function | //+------------------------------------------------------------------+ void OnInit() { //---- Initialization of variables of data calculation starting point numPrognoz=int(inumPrognoz); begin=int(ibegin); end=int(iend); Shift=int(MathMax(numPrognoz-begin,0)); min_rates_total=end+numPrognoz; //----Checking the input variables if(end=0; bar--) IndBuffer[bar]=0.0; //---- indexing elements in arrays as in timeseries ArraySetAsSeries(time,true); ArraySetAsSeries(close,true); //--- Determine coefficients for(int k=end; k>=begin; k--) b[k]=k; int start=begin-numPrognoz; int finish=end+numPrognoz+1; for(int bar=0; bar