//+------------------------------------------------------------------+ //| Plombiers.mq5 | //| Copyright 2009-20010, Avatara@bigmir.net | //+------------------------------------------------------------------+ #property copyright "2009-2010, Avatara@bigmir.net" #property link "Avatara@bigmir.net" #property version "1.00"//22/11/09 //регрессия copyright "ANG3110@latchess.com" #property description "Построение канала с равноудаленными" #property description "на величину стандартнoго отклонения " #property description "значениями апроксимированного МНК" #property description "полинома произвольного порядка" #property description "и вписанного в него осцилятора" #property description "Stochastic" //#property indicator_separate_window #property indicator_chart_window #property indicator_buffers 6 #property indicator_plots 6 //---- plot Means #property indicator_label1 "Means" #property indicator_type1 DRAW_LINE #property indicator_color1 RoyalBlue #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //---- plot Label2 #property indicator_label2 "Resistance" #property indicator_type2 DRAW_LINE #property indicator_color2 LimeGreen #property indicator_style2 STYLE_SOLID #property indicator_width2 2 //---- plot Label3 #property indicator_label3 "Support" #property indicator_type3 DRAW_LINE #property indicator_color3 LimeGreen #property indicator_style3 STYLE_SOLID #property indicator_width3 2 //---- plot Label4 #property indicator_label4 "Resistance+" #property indicator_type4 DRAW_LINE #property indicator_color4 LightBlue #property indicator_style4 STYLE_DASH #property indicator_width4 1 //---- plot Label5 #property indicator_label5 "Support-" #property indicator_type5 DRAW_LINE #property indicator_color5 LightBlue #property indicator_style5 STYLE_DASH #property indicator_width5 1 //---- plot Label6 #property indicator_label6 "Signal" #property indicator_type6 DRAW_LINE #property indicator_color6 Seashell #property indicator_style6 STYLE_DOT #property indicator_width6 1 //----------------------------------- enum intType { i0 = 0, // 0 - просто средняя i1 = 1, // 1 - прямая i2 = 2, // парабола 2-го порядка i3 = 3, // парабола 3-го порядка i4 = 4 // 4-го порядка }; //--- input parameters ------ input int bars_IN = 144; // длина данных input intType SP = i2; // порядок кривой input int N_Shift1 = 0; // сдвиг назад в историю input int Forecast=0; // длина продления канала в "будущее" input double kstd = 3.1415; // множитель стандартного отклонения input bool Oscilator=true; // отображать осцилятор? input int N_Buff=1; // отображамый буфер осцилятора input int Ka=21; // период для вычисления линии %K. input int La=7; // период yсреднения %D input int Za=1; // замедление input ENUM_MA_METHOD Oe=MODE_SMA; // метод yсреднения input ENUM_STO_PRICE Me=STO_CLOSECLOSE; // цены для Stochastic input int DIGf = -99; // Количество знаков после запятой.-99 Digits string sName="Plombiers 1.0"; //-------------------------- double ai[12][12],b[12],x[12],sx[12]; double sum,Mnog,COG[]; int N,i,N1,j,k,LM,hOsc,Dig,hFl,N_Shift; double qq,mm,tt,sq,std; //--- indicator buffers double Means[]; double level1h[]; double level1l[]; double level2h[]; double level2l[]; double S[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,Means,INDICATOR_DATA); SetIndexBuffer(1,level1h,INDICATOR_DATA); SetIndexBuffer(2,level1l,INDICATOR_DATA); SetIndexBuffer(3,level2h,INDICATOR_DATA); SetIndexBuffer(4,level2l,INDICATOR_DATA); SetIndexBuffer(5,S,INDICATOR_DATA); ArraySetAsSeries(Means,true);ArraySetAsSeries(S,true); ArraySetAsSeries(level1h,true);ArraySetAsSeries(level2h,true); ArraySetAsSeries(level1l,true);ArraySetAsSeries(level2l,true); //--- set accuracy IndicatorSetInteger(INDICATOR_DIGITS,Digits()); N_Shift=N_Shift1; if(N_Shift<0)N_Shift=-N_Shift; N=bars_IN+N_Shift; N1=Bars(Symbol(),PERIOD_CURRENT); if(N1=1;i--) { tt=0.0; for(j=1;j<=k-i;j++) { tt=tt+ai[i][i+j]*x[i+j]; x[i]=(1.0/ai[i][i])*(b[i]-tt); } } //+------------------------------------------------------------------+ for(i=N_Shift-Forecast;i=N_Shift;i--) { S[i+Forecast]=Means[i+Forecast]+sq*(S[i]-50.0)/44.9999;} for(i=0;i