//+------------------------------------------------------------------+ //| MACDAK.mq4 | //| Konstantin Drozdov 2013, | //| drozdov.09@bk.ru | //+------------------------------------------------------------------+ #property copyright "Konstantin Drozdov 2013," #property link "drozdov.09@bk.ru" #property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 Red #property indicator_color2 Blue #property indicator_color3 Green #property indicator_color4 Green #property indicator_color5 Crimson #property indicator_color6 Crimson #property indicator_color7 MediumBlue #property indicator_color8 MediumBlue #property indicator_width1 2 #property indicator_width2 2 #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 parameters extern int Ma_1=13; extern int Ma_2=26; extern string _Price = "0-CLOSE,1-OPEN,2-HIGH,3-LOW,4-MEDIAN,5-TYPICAL,6-WEIGHTED"; extern int Price_1=0; extern int Price_2=0; extern string _Metod = "0-SMA,1-EMA,2-SMMA,3-LWMA"; extern int Metod_1=1; extern int Metod_2=1; extern string _Per = "0-тек,1-1мин.,5-5мин.,15-15мин.,"; extern string _Per1 = "60-1час,240-4саса,1440-день"; extern int Per = 0; extern string _All = "вкл/выкл алертов"; extern bool All = true; int i,limit; double m,m1,m2,ma,ma1,ma2,mac,mac1,mac2; static bool al = false,flag = true; //--- buffers double BufferRed[]; double BufferBlue[]; double BufferGreen[]; double Buffer_1Green[]; double BufferCrimson[]; double Buffer_1Crimson[]; double BufferMediumBlue[]; double Buffer_1MediumBlue[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,BufferRed); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,BufferBlue); SetIndexStyle(2,DRAW_HISTOGRAM); SetIndexBuffer(2,BufferGreen); SetIndexStyle(3,DRAW_HISTOGRAM); SetIndexBuffer(3,Buffer_1Green); SetIndexStyle(4,DRAW_HISTOGRAM); SetIndexBuffer(4,BufferCrimson); SetIndexStyle(5,DRAW_HISTOGRAM); SetIndexBuffer(5,Buffer_1Crimson); SetIndexStyle(6,DRAW_HISTOGRAM); SetIndexBuffer(6,BufferMediumBlue); SetIndexStyle(7,DRAW_HISTOGRAM); SetIndexBuffer(7,Buffer_1MediumBlue); //---- IndicatorDigits(Digits+1); IndicatorShortName(" MACDAC "); if(Metod_1<0 || Metod_1>3)Alert(" Metod должен быть от 0 до 3 ","\n"," (0-SMA,1-EMA,2-SMMA,3-LWMA) "); if(Metod_2<0 || Metod_2>3)Alert(" Metod должен быть от 0 до 3 ","\n"," (0-SMA,1-EMA,2-SMMA,3-LWMA) "); if(Price_1<0 || Price_1>6)Alert(" Price должен быть от 0 до 6 ","\n"," (0-CLOSE,1-OPEN,2-HIGH,3-LOW,4-MEDIAN,5-TYPICAL,6-WEIGHTED) "); if(Price_2<0 || Price_2>6)Alert(" Price должен быть от 0 до 6 ","\n"," (0-CLOSE,1-OPEN,2-HIGH,3-LOW,4-MEDIAN,5-TYPICAL,6-WEIGHTED) "); //===================================================================$ //===================================================================$ return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit,i; int counted_bars=IndicatorCounted(); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- for(i=0; im1 && mac1mac && (mac1-mac)>0) { BufferCrimson[i] = BufferRed[i]; Buffer_1Crimson[i] = BufferBlue[i]; } //------------------------------------------------------- if(m>ma && m>m1 && mac1>mac && (mac1-mac)>0) { BufferMediumBlue[i] = BufferRed[i]; Buffer_1MediumBlue[i] = BufferBlue[i]; } //------------------------------------------------------- if(mma && mac1<0 && mac>0)text = "Смена тренда.Тренд вверх!!!"; if(m1>ma1 && m=0 && mac<=0)text = "Смена тренда.Тренд вниз!!!"; if(m2>m1 && m1m && mac1>=mac)text = "ПРОДАЁМ!!!"; if(m>ma && m>m1 && mac2<=mac1 && mac1>mac)text = "Коррекция вверх!!!"; if(m=mac1 && mac1ma && m>m1 && mac2>=mac1 && mac1mac)text = "Коррекция закончилась.ПРОДАЁМ!!!"; if(m>ma && Askma)text = "Цена в зоне ценности.Готовимся к покупке!!!"; if(mm && Bid