#property copyright "Copyright © 2017, Khlistov Vladimir" #property link "http://cmillion.ru" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 clrBlue #property indicator_color2 clrRed extern int candle = 1; //кол-во свечей extern bool Notification = false; // Посылает уведомление на мобильные терминалы, чьи MetaQuotes ID указаны в окне настроек на закладке "Уведомления". extern bool alert = true; // Звуковое оповещение. extern bool email = true; // E-mail с указанием информации по сигналу: Инструмент/Направление/Время сигнала/ double buffer1[]; double buffer2[]; datetime TimeSignal=0; int OnInit() { SetIndexBuffer(0, buffer1); SetIndexBuffer(1, buffer2); SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID, 1); SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, 1); SetIndexArrow(0, 233); SetIndexArrow(1, 234); return(INIT_SUCCEEDED); } int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int counted_bars=IndicatorCounted(); int j,i,limit=Bars-counted_bars; if (limit+candle>=Bars) limit=Bars-candle; for(i=limit; i>=0; i--) { int N=0; for(j=i; j<=candle+i; j++) { if (close[j] > open[j]) { if (N!=-1) N=1; else {N=-2;break;} } if (close[j] < open[j]) { if (N!=1) N=-1; else {N=-2;break;} } } if (N==-1) { buffer1[i]=Low[i]; if (i==0 && TimeSignal!=Time[i]) send(StringConcatenate(Symbol()," ",candle," нисходящих свечей подряд ",TimeToStr(Time[i],TIME_DATE|TIME_SECONDS))); continue; } if (N==1) { buffer2[i]=High[i]; if (i==0 && TimeSignal!=Time[i]) send(StringConcatenate(Symbol()," ",candle," восходящих свечей подряд ",TimeToStr(Time[i],TIME_DATE|TIME_SECONDS))); continue; } buffer1[i]=EMPTY_VALUE; buffer2[i]=EMPTY_VALUE; } return(0); } void send(string txt) { if (Notification) SendNotification(txt); if (email) SendMail(IntegerToString(AccountNumber()),txt); if (alert) Alert(txt); TimeSignal=Time[0]; }