//------------------------------------------------------------------ #property copyright "mladen" #property link "www.forex-tsd.com" //------------------------------------------------------------------ #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 LimeGreen #property indicator_color2 Orange #property indicator_width1 2 #property indicator_width2 2 double dotUp[]; double dotDn[]; double trend[]; //-------------------------------------------------------- // //-------------------------------------------------------- int init() { IndicatorBuffers(3); SetIndexBuffer(0,dotUp); SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,159); SetIndexBuffer(1,dotDn); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,159); SetIndexBuffer(2,trend); return(0); } int deinit() { return(0); } //-------------------------------------------------------- // //-------------------------------------------------------- // // // // // int start() { int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; int limit=MathMin(Bars-counted_bars,Bars-1); // // // // // for (int i=limit; i>=0; i--) { dotUp[i] = EMPTY_VALUE; dotDn[i] = EMPTY_VALUE; trend[i] = trend[i+1]; double atr = iATR(NULL,0,20,i); double range0 = High[i ]-Low[i ]; double range7 = High[i+7]-Low[i+7]; if (Close[i]Low[i+2] && Close[i+1] > Close[i+7] && Close[i+1] > High[i+4] && range0>range7 && trend[i]!= 1) { dotUp[i] = Low[i] - atr/2.0; trend[i] = 1; } if (Close[i]>Open[i] && Open[i]range7 && trend[i]!=-1) { dotDn[i] = High[i] + atr/2.0; trend[i] = -1; } } return(0); }