/// <summary> /// Average Directional Movement Rating quantifies momentum change in the ADX. It is calculated by adding two values of ADX (the current value and a value n periods back), then dividing by two. This additional smoothing makes the ADXR slightly less responsive than ADX. The interpretation is the same as the ADX; the higher the value, the stronger the trend. /// </summary> /// <returns></returns> public ADXR ADXR(Data.IDataSeries input, int interval, int period) { if (cacheADXR != null) { for (int idx = 0; idx < cacheADXR.Length; idx++) { if (cacheADXR[idx].Interval == interval && cacheADXR[idx].Period == period && cacheADXR[idx].EqualsInput(input)) { return(cacheADXR[idx]); } } } lock (checkADXR) { checkADXR.Interval = interval; interval = checkADXR.Interval; checkADXR.Period = period; period = checkADXR.Period; if (cacheADXR != null) { for (int idx = 0; idx < cacheADXR.Length; idx++) { if (cacheADXR[idx].Interval == interval && cacheADXR[idx].Period == period && cacheADXR[idx].EqualsInput(input)) { return(cacheADXR[idx]); } } } ADXR indicator = new ADXR(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Interval = interval; indicator.Period = period; Indicators.Add(indicator); indicator.SetUp(); ADXR[] tmp = new ADXR[cacheADXR == null ? 1 : cacheADXR.Length + 1]; if (cacheADXR != null) { cacheADXR.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheADXR = tmp; return(indicator); } }
/// <summary> /// Average Directional Movement Rating quantifies momentum change in the ADX. It is calculated by adding two values of ADX (the current value and a value n periods back), then dividing by two. This additional smoothing makes the ADXR slightly less responsive than ADX. The interpretation is the same as the ADX; the higher the value, the stronger the trend. /// </summary> /// <returns></returns> public ADXR ADXR(Data.IDataSeries input, int interval, int period) { if (cacheADXR != null) for (int idx = 0; idx < cacheADXR.Length; idx++) if (cacheADXR[idx].Interval == interval && cacheADXR[idx].Period == period && cacheADXR[idx].EqualsInput(input)) return cacheADXR[idx]; lock (checkADXR) { checkADXR.Interval = interval; interval = checkADXR.Interval; checkADXR.Period = period; period = checkADXR.Period; if (cacheADXR != null) for (int idx = 0; idx < cacheADXR.Length; idx++) if (cacheADXR[idx].Interval == interval && cacheADXR[idx].Period == period && cacheADXR[idx].EqualsInput(input)) return cacheADXR[idx]; ADXR indicator = new ADXR(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Interval = interval; indicator.Period = period; Indicators.Add(indicator); indicator.SetUp(); ADXR[] tmp = new ADXR[cacheADXR == null ? 1 : cacheADXR.Length + 1]; if (cacheADXR != null) cacheADXR.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheADXR = tmp; return indicator; } }