//+------------------------------------------------------------------+ //| Objective.mq5 | //| Copyright © 2011, LeMan. | //| b-market@mail.ru | //+------------------------------------------------------------------+ #property copyright "Copyright © 2011, LeMan." #property link "b-market@mail.ru" #property description "Objective" //---- номер версии индикатора #property version "1.01" //---- отрисовка индикатора в главном окне #property indicator_chart_window //+-----------------------------------+ //| объявление констант | //+-----------------------------------+ #define LINES_TOTAL 8 // Константа для количества линий индикатора #define RESET 0 // Константа для возврата терминалу команды на пересчёт индикатора //---- количество индикаторных буферов #property indicator_buffers LINES_TOTAL //---- использовано всего графических построений #property indicator_plots LINES_TOTAL //+-----------------------------------+ //| Параметры отрисовки индикаторов | //+-----------------------------------+ //---- отрисовка индикаторов в виде линий #property indicator_type1 DRAW_LINE #property indicator_type2 DRAW_LINE #property indicator_type3 DRAW_LINE #property indicator_type4 DRAW_LINE #property indicator_type5 DRAW_LINE #property indicator_type6 DRAW_LINE #property indicator_type7 DRAW_LINE #property indicator_type8 DRAW_LINE //---- выбор цветов линий #property indicator_color1 clrRed #property indicator_color2 clrRed #property indicator_color3 clrRed #property indicator_color4 clrRed #property indicator_color5 clrGreen #property indicator_color6 clrGreen #property indicator_color7 clrGreen #property indicator_color8 clrGreen //---- линии - штрихпунктирные кривые #property indicator_style1 STYLE_DASHDOTDOT #property indicator_style2 STYLE_DASHDOTDOT #property indicator_style3 STYLE_DASHDOTDOT #property indicator_style4 STYLE_DASHDOTDOT #property indicator_style5 STYLE_DASHDOTDOT #property indicator_style6 STYLE_DASHDOTDOT #property indicator_style7 STYLE_DASHDOTDOT #property indicator_style8 STYLE_DASHDOTDOT //---- толщина линий 1 #property indicator_width1 1 #property indicator_width2 1 #property indicator_width3 1 #property indicator_width4 1 #property indicator_width5 1 #property indicator_width6 1 #property indicator_width7 1 #property indicator_width8 1 //+-----------------------------------+ //| ВХОДНЫЕ ПАРАМЕТРЫ ИНДИКАТОРА | //+-----------------------------------+ input uint Sample=20; input uint Quartile_1 = 25; input uint Quartile_2 = 50; input uint Quartile_3 = 75; input int Shift=0; // сдвиг индикатора по горизонтали в барах //+-----------------------------------+ //---- объявление глобальных переменных int n0,n1,n2,n3; double HOArray[],OLArray[]; //---- Объявление целых переменных начала отсчёта данных int min_rates_total,N_; //+------------------------------------------------------------------+ //| Массивы переменных для создания индикаторных буферов | //+------------------------------------------------------------------+ class CIndicatorsBuffers { public: double IndBuffer[]; }; //+------------------------------------------------------------------+ //| Создание индикаторных буферов | //+------------------------------------------------------------------+ CIndicatorsBuffers Ind[LINES_TOTAL]; //+------------------------------------------------------------------+ //| Массивы переменных для создания индикаторных буферов | //+------------------------------------------------------------------+ int GetVelue(string InVelueName,int InVelue) { //---- if(InVelue>100) { Print("Параметр "+InVelueName+" не может быть больше 100! Будет использовано значение по умолчанию, равное 100!"); return(100); } if(InVelue<0) { Print("Параметр "+InVelueName+" не может быть меньше 0! Будет использовано значение по умолчанию, равное 0!"); return(0); } //---- return(InVelue); } //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ void OnInit() { //---- Инициализация констант double P1=GetVelue("Quartile_1",Quartile_1); double P2=GetVelue("Quartile_2",Quartile_2); double P3=GetVelue("Quartile_3",Quartile_3); N_=int(Sample); if(N_<3){N_=3; Print("Параметр Sample не может быть меньше 3! Будет использовано значение по умолчанию, равное 3!");} min_rates_total=N_; n0=N_-1; n1=int(MathRound(N_*P1/100)); if(!n1) n1=100; n2=int(MathRound(N_*P2/100)); if(!n2) n2=100; n3=int(MathRound(N_*P3/100)); if(!n3) n3=100; //---- распределение памяти под массивы переменных if(ArrayResize(HOArray,N_)