//------------------------------------------------------------------- // original : ANG3110 // this version : mladen //------------------------------------------------------------------- #property indicator_separate_window #property indicator_buffers 4 #property indicator_color1 LightSlateGray #property indicator_color2 DodgerBlue #property indicator_color3 SandyBrown #property indicator_color4 SandyBrown #property indicator_style1 STYLE_DOT #property indicator_width2 2 #property indicator_width3 2 #property indicator_width4 2 extern int period = 14; extern int Level = 25; extern double Smooth = 15; double ADX[],ADXLa[],ADXLb[],DI[]; //------------------------------------------------------------------- // //------------------------------------------------------------------- // // // // // int init() { SetIndexBuffer(0,DI); SetIndexBuffer(1,ADX); SetIndexBuffer(2,ADXLa); SetIndexBuffer(3,ADXLb); SetLevelValue(0,0); SetLevelValue(1, Level); SetLevelValue(2,-Level); IndicatorShortName("ADXm "+"("+period+","+DoubleToStr(Smooth,2)+")"); return(0); } //------------------------------------------------------------------- // //------------------------------------------------------------------- // // // // // double work[][4]; #define zdh 0 #define zdl 1 #define zdx 2 #define slope 3 int start() { int i,r,counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; double alpha = 2.0/(period+1); int limit = MathMin(Bars-counted_bars,Bars-1); if (ArrayRange(work,0)!=Bars) ArrayResize(work,Bars); // // // // // if (work[limit][slope]==-1) CleanPoint(limit,ADXLa,ADXLb); for (i=limit,r=Bars-i-1; i>=0; i--,r++) { if (i==Bars-1) { work[r][zdh] = 0; work[r][zdl] = 0; work[r][zdx] = 0; continue; } double hc = iSsm(High[i] ,Smooth,i,0); double lc = iSsm(Low[i] ,Smooth,i,1); double cp = iSsm(Close[i+1],Smooth,i,2); double hp = iSsm(High[i+1] ,Smooth,i,3); double lp = iSsm(Low[i+1] ,Smooth,i,4); double dh = MathMax(hc-hp,0); double dl = MathMax(lp-lc,0); if(dh==dl) {dh=0; dl=0;} else if(dh