//+------------------------------------------------------------------+ //| Divination _MA | //| vorese | //| vorese@yandex.ru | //+------------------------------------------------------------------+ #property indicator_chart_window extern string s1="-----Период МА-----"; extern int Period_MA1=5; extern int Period_MA2=34; extern int Period_MA3=45; extern string s2="-----Метод расчета МА-----"; extern int metod_MA1=0; extern int metod_MA2=0; extern int metod_MA3=0; extern string s3="-----Ценовая константа МА-----"; extern int price_MA1=5; extern int price_MA2=5; extern int price_MA3=5; extern string s4="==========================================="; extern string s5="---количество баров-----"; extern int Max_bar = 6000; extern string s6="ценовая константа бара"; extern int price_const=5; extern string s7="допуст. отклонение цены %-----"; extern double deviation_perc=15; extern string s8="==========================================="; extern string s9="-----цвет линий-----"; extern color Line1_color=Red; extern color Line2_color=Gold; extern string s10="N для неск. индикаторов в окне"; extern int indicator_num=0; extern string s11="печатать сообщения"; extern bool active_Print=false; extern string s12="комментарии"; extern bool active_Comment=true; //+-------------------------------------------------------------------- int count_bar; int limit; int process; int shift; //=================================================================== int init() { if(Max_bar>=Bars)limit=Bars; else limit=Max_bar; //------------------------------------------------------------------- ObjectCreate(indicator_num+"1_line_bar", OBJ_VLINE, 0,Time[shift],0,0); ObjectSet(indicator_num+"1_line_bar",OBJPROP_COLOR,Line1_color); //------------------------------------------------------------------- return(0); } //==================================================================== int deinit() { for(int i=0;i=MathAbs(pips1i)-MathAbs(pips1i)*deviation_perc/100 && MathAbs(pips2)<=MathAbs(pips2i)+MathAbs(pips2i)*deviation_perc/100 && MathAbs(pips2)>=MathAbs(pips2i)-MathAbs(pips2i)*deviation_perc/100 && MathAbs(pips3)<=MathAbs(pips3i)+MathAbs(pips3i)*deviation_perc/100 && MathAbs(pips3)>=MathAbs(pips3i)-MathAbs(pips3i)*deviation_perc/100 ) { //отрисовка линий if( shift!=i) { ObjectCreate(indicator_num+"2_line_bar"+count_bar, OBJ_VLINE, 0,Time[i],0,0); ObjectSet(indicator_num+"2_line_bar"+count_bar,OBJPROP_COLOR,Line2_color); count_bar++; } } } //------------------------------------------------------------------ if(active_Print) Print(" бар N ",shift," ; совпадений ",count_bar, " ; линий на графике ",ObjectsTotal(OBJ_VLINE), " ; баров в истории ",Bars, " ; обработано баров ",process); if(active_Comment) Comment(" бар N ",shift, "\n"," совпадений ",count_bar, "\n"," линий на графике ",ObjectsTotal(OBJ_VLINE), "\n"," баров в истории ",Bars, "\n"," обработано баров ",process); return(0); } //+------------------------------------------------------------------+ double f_Price_bar(int constant,int bar)// цена бара { double price; switch(constant) { case 0:price=Close[bar]; break; case 1:price=Open[bar]; break; case 2:price=High[bar]; break; case 3:price=Low[bar]; break; case 4:price=(High[bar]+Low[bar])/2; break; case 5:price=(Close[bar]+High[bar]+Low[bar])/3; break; case 6:price=(Close[bar]+Close[bar]+High[bar]+Low[bar])/4; break; } return(NormalizeDouble(price,Digits)); } //==================================================================== int f_Comparison (double variable_1,double variable_2) { int results; if(variable_1==variable_2)results=0; else { if(variable_1