//+------------------------------------------------------------------+ //| Copyright © 2012, Khlystov Vladimir | //| http://cmillion.narod.ru | //+------------------------------------------------------------------+ #property copyright "Copyright © 2012, cmillion@narod.ru" #property link "http://cmillion.narod.ru" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Blue #property indicator_color2 Red #property indicator_width1 3 #property indicator_width2 3 extern int channel =12; // ширина "рабочего канала" в пунктах (в представлении с 5-ю знаками после запятой) extern int Q = 6; // число последовательных пересечений противоположных сторон "рабочего канала" double SignalBufferRed[]; double SignalBufferBlue[]; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { SetIndexStyle(0,DRAW_ARROW,0,3); SetIndexArrow(0,233); SetIndexStyle(1,DRAW_ARROW,0,3); SetIndexArrow(1,234); SetIndexBuffer(0,SignalBufferBlue); SetIndexBuffer(1,SignalBufferRed); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int deinit() { ObjectsDeleteAll(0); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit=Bars-counted_bars; if(counted_bars==0) limit--; for(int j=limit; j>=0; j--) { bool NoSell=false,NoBuy=false; int q=0; int i=j; double GN[2][10]; ArrayInitialize(GN,0); while(i=Close[j]+channel*Point) NoBuy=true; if(Low[i]<=Close[j]-channel*Point || High[i]>=Close[j]+channel*2*Point) NoSell=true; if(NoBuy && NoSell) break; if(NoBuy) { if(High[i]>=Close[j]+channel*Point) { if(q==0 || q==2 || q==4 || q==6 || q==8 || q==10) {GN[0][q]=Time[i]; GN[1][q]=Close[j]+channel*Point; q++; i++;} } if(Low[i]<=Close[j]) { if(q==1 || q==3 || q==5 || q==7 || q==9 || q==11) {GN[0][q]=Time[i]; GN[1][q]=Close[j]; q++; i++;} } } if(NoSell) { if(Low[i]<=Close[j]-channel*Point) { if(q==0 || q==2 || q==4 || q==6 || q==8 || q==10) {GN[0][q]=Time[i]; GN[1][q]=Close[j]-channel*Point; q++; i++;} } if(High[i]>=Close[j]) { if(q==1 || q==3 || q==5 || q==7 || q==9 || q==11) {GN[0][q]=Time[i]; GN[1][q]=Close[j]; q++; i++;} } } if(q>=Q || q>10) { if(NoSell) SignalBufferBlue[j]=Close[j]; if(NoBuy) SignalBufferRed[j]=Close[j]; for(int n=0; n