////////////////////////////////////////////////////////////////////// // // LinearRegression.mq4 // Copyright © 2008 Antonuk Oleg // ////////////////////////////////////////////////////////////////////// #property copyright "Copyright © 2008 Antonuk Oleg" #property link "antonukoleg@gmail.com" #property indicator_chart_window #property indicator_buffers 1 #property indicator_width1 1 #property indicator_color1 Gold extern int barsToCount=50; double buffer0[]; ////////////////////////////////////////////////////////////////////// int init() { IndicatorShortName("linearRegression"); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,buffer0); SetIndexEmptyValue(0,0.0); return(0); } ////////////////////////////////////////////////////////////////////// int deinit() { return(0); } ////////////////////////////////////////////////////////////////////// int start() { // calculate price values double a,b,c, sumy=0.0, sumx=0.0, sumxy=0.0, sumx2=0.0; for(int i=0; i