//------------------------------------------------------------------- #property copyright "www.forex-tsd.com" #property link "www.forex-tsd.com" //------------------------------------------------------------------- #property indicator_separate_window #property indicator_buffers 6 #property indicator_color1 DodgerBlue #property indicator_color2 LightSlateGray #property indicator_color3 SandyBrown #property indicator_color4 DodgerBlue #property indicator_color5 SandyBrown #property indicator_color6 SandyBrown #property indicator_style1 STYLE_DOT #property indicator_style2 STYLE_DOT #property indicator_style3 STYLE_DOT #property indicator_width4 2 #property indicator_width5 2 #property indicator_width6 2 #import "dynamicZone.dll" double dzBuyP(double& sourceArray[],double probabiltyValue, int lookBack, int bars, int i, double precision ); double dzSellP(double& sourceArray[],double probabiltyValue, int lookBack, int bars, int i, double precision ); #import // // // // // extern int period = 14; extern double Smooth = 15; extern int AdaptPeriod = 14; extern int DzLookBackBars = 70; extern double DzStartBuyProbability = 0.10; extern double DzStartSellProbability = 0.10; double ADX[],ADXLa[],ADXLb[],DI[],bl1[], sl1[], zli[]; //------------------------------------------------------------------- // //------------------------------------------------------------------- // // // // // int init() { IndicatorBuffers(7); SetIndexBuffer(0,sl1); SetIndexBuffer(1,zli); SetIndexBuffer(2,bl1); SetIndexBuffer(3,ADX); SetIndexBuffer(4,ADXLa); SetIndexBuffer(5,ADXLb); SetIndexBuffer(6,DI); IndicatorShortName("Dynamic zones ADXm stddev adaptive "+"("+period+","+DoubleToStr(Smooth,2)+","+DoubleToStr(AdaptPeriod,2)+")"); return(0); } //------------------------------------------------------------------- // //------------------------------------------------------------------- // // // // // double work[][3]; #define zdh 0 #define zdl 1 #define slope 2 int start() { int i,r,counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; 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; ADX[i] = 0; continue; } double dev = iStdDev(NULL,0,AdaptPeriod,0,MODE_SMA,PRICE_CLOSE,i); double avg = iSma(dev,AdaptPeriod,i,0); if (dev!=0) double tperiod = period*avg/dev; else tperiod = period; double alpha = 2.0/(tperiod+1); 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