//+------------------------------------------------------------------+ //| Stohastic With Flat.mq4 | //| Powered byStep | //| 04/03/14 | //+------------------------------------------------------------------+ #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Green #property indicator_color2 Red extern string Stohastic = "Stohastic With Flat"; extern int K = 5; extern int D = 3; extern int slow = 3; extern int avg_meth = 0; extern int price = 1; extern int BB = 20; extern double flat =0.0009; double Buf_0[],Buf_1[]; int init() { SetIndexBuffer(0,Buf_0); SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1); SetIndexBuffer(1,Buf_1); SetIndexStyle (1,DRAW_LINE,STYLE_SOLID,1); return(0); } //-------------------------------------------------------------------- int start() { int i, Counted_bars; //-------------------------------------------------------------------- Counted_bars=IndicatorCounted(); i=Bars-Counted_bars-1; while(i>=0) { if ((iBands(NULL,0,BB,2,0,PRICE_MEDIAN,MODE_UPPER,i)- iBands(NULL,0,BB,2,0,PRICE_MEDIAN,MODE_MAIN,i)) < flat) { if (iStochastic(NULL,0,K,D,slow,avg_meth,price,MODE_MAIN,i) > iStochastic(NULL,0,K,D,slow,avg_meth,price,MODE_SIGNAL,i)) {Buf_0[i] = 55;Buf_1[i] = 45;} if (iStochastic(NULL,0,K,D,slow,avg_meth,price,MODE_MAIN,i) < iStochastic(NULL,0,K,D,slow,avg_meth,price,MODE_SIGNAL,i)) {Buf_0[i] = 45;Buf_1[i] = 55;} } else { Buf_0[i]=iStochastic(NULL,0,K,D,slow,avg_meth,price,MODE_MAIN,i); Buf_1[i]=iStochastic(NULL,0,K,D,slow,avg_meth,price,MODE_SIGNAL,i); } i--; } //-------------------------------------------------------------------- return(0); }