protected override void OnStartUp() { myadx = this.ZADX(aDXLen, adxType, 1.0, RWT_HA.SecondaryOHLC.NONE, (useJustInput?RWT_HA.PrimaryOHLC.INPUTS:RWT_HA.PrimaryOHLC.BARS), aDXLen, dmType); mystoch = this.zStochastic(myadx.ADX, windowLength, true); }
/// <summary> /// better adx /// </summary> /// <returns></returns> public ZADX ZADX(Data.IDataSeries input, int aDXLength, RWT_MA.MAType aDXType, double barSmoothArg, RWT_HA.SecondaryOHLC barSmoothType, RWT_HA.PrimaryOHLC barsType, int dMLength, RWT_MA.MAType dMType) { if (cacheZADX != null) { for (int idx = 0; idx < cacheZADX.Length; idx++) { if (cacheZADX[idx].ADXLength == aDXLength && cacheZADX[idx].ADXType == aDXType && Math.Abs(cacheZADX[idx].BarSmoothArg - barSmoothArg) <= double.Epsilon && cacheZADX[idx].BarSmoothType == barSmoothType && cacheZADX[idx].BarsType == barsType && cacheZADX[idx].DMLength == dMLength && cacheZADX[idx].DMType == dMType && cacheZADX[idx].EqualsInput(input)) { return(cacheZADX[idx]); } } } lock (checkZADX) { checkZADX.ADXLength = aDXLength; aDXLength = checkZADX.ADXLength; checkZADX.ADXType = aDXType; aDXType = checkZADX.ADXType; checkZADX.BarSmoothArg = barSmoothArg; barSmoothArg = checkZADX.BarSmoothArg; checkZADX.BarSmoothType = barSmoothType; barSmoothType = checkZADX.BarSmoothType; checkZADX.BarsType = barsType; barsType = checkZADX.BarsType; checkZADX.DMLength = dMLength; dMLength = checkZADX.DMLength; checkZADX.DMType = dMType; dMType = checkZADX.DMType; if (cacheZADX != null) { for (int idx = 0; idx < cacheZADX.Length; idx++) { if (cacheZADX[idx].ADXLength == aDXLength && cacheZADX[idx].ADXType == aDXType && Math.Abs(cacheZADX[idx].BarSmoothArg - barSmoothArg) <= double.Epsilon && cacheZADX[idx].BarSmoothType == barSmoothType && cacheZADX[idx].BarsType == barsType && cacheZADX[idx].DMLength == dMLength && cacheZADX[idx].DMType == dMType && cacheZADX[idx].EqualsInput(input)) { return(cacheZADX[idx]); } } } ZADX indicator = new ZADX(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.ADXLength = aDXLength; indicator.ADXType = aDXType; indicator.BarSmoothArg = barSmoothArg; indicator.BarSmoothType = barSmoothType; indicator.BarsType = barsType; indicator.DMLength = dMLength; indicator.DMType = dMType; Indicators.Add(indicator); indicator.SetUp(); ZADX[] tmp = new ZADX[cacheZADX == null ? 1 : cacheZADX.Length + 1]; if (cacheZADX != null) { cacheZADX.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheZADX = tmp; return(indicator); } }