#property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Black #property indicator_color2 Blue #property indicator_color3 Red double BufCCI[]; double BufUp[]; double BufDown[]; extern int CCI_Period = 20; extern int UP_Line = 100; extern int Down_Line = 100; int init() { SetIndexBuffer(0,BufCCI); SetIndexBuffer(1,BufUp); SetIndexBuffer(2,BufDown); SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,EMPTY_VALUE); SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,2,Blue); SetIndexArrow(1,233); SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID,2,Red); SetIndexArrow(2,234); return(0); } int start() { int counted_bar = IndicatorCounted(); int limit = Bars-counted_bar; if(counted_bar == 0) limit -= CCI_Period-1; for (int i = limit-1; i>=0; i--) { BufCCI[i] = iCCI(NULL,0,CCI_Period,5,i); } if(counted_bar == 0) limit -= 2; for (i = limit-1; i>=0; i--) { BufUp[i] = EMPTY_VALUE; if(BufCCI[i+1] < UP_Line && BufCCI[i] > UP_Line) { BufUp[i] = Low[i]-20*Point; } BufDown[i] = EMPTY_VALUE; if(BufCCI[i+1] > -Down_Line && BufCCI[i] < -Down_Line) { BufDown[i] = High[i]+20*Point; } } return(0); }