/// <summary> /// Standard Error shows how near prices go around a linear regression line. The closer the prices are to the linear regression line, the stronger is the trend. /// </summary> /// <returns></returns> public StdError StdError(Data.IDataSeries input, int period) { if (cacheStdError != null) { for (int idx = 0; idx < cacheStdError.Length; idx++) { if (cacheStdError[idx].Period == period && cacheStdError[idx].EqualsInput(input)) { return(cacheStdError[idx]); } } } lock (checkStdError) { checkStdError.Period = period; period = checkStdError.Period; if (cacheStdError != null) { for (int idx = 0; idx < cacheStdError.Length; idx++) { if (cacheStdError[idx].Period == period && cacheStdError[idx].EqualsInput(input)) { return(cacheStdError[idx]); } } } StdError indicator = new StdError(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Period = period; Indicators.Add(indicator); indicator.SetUp(); StdError[] tmp = new StdError[cacheStdError == null ? 1 : cacheStdError.Length + 1]; if (cacheStdError != null) { cacheStdError.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheStdError = tmp; return(indicator); } }
/// <summary> /// Standard Error shows how near prices go around a linear regression line. The closer the prices are to the linear regression line, the stronger is the trend. /// </summary> /// <returns></returns> public StdError StdError(Data.IDataSeries input, int period) { if (cacheStdError != null) for (int idx = 0; idx < cacheStdError.Length; idx++) if (cacheStdError[idx].Period == period && cacheStdError[idx].EqualsInput(input)) return cacheStdError[idx]; lock (checkStdError) { checkStdError.Period = period; period = checkStdError.Period; if (cacheStdError != null) for (int idx = 0; idx < cacheStdError.Length; idx++) if (cacheStdError[idx].Period == period && cacheStdError[idx].EqualsInput(input)) return cacheStdError[idx]; StdError indicator = new StdError(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.Period = period; Indicators.Add(indicator); indicator.SetUp(); StdError[] tmp = new StdError[cacheStdError == null ? 1 : cacheStdError.Length + 1]; if (cacheStdError != null) cacheStdError.CopyTo(tmp, 0); tmp[tmp.Length - 1] = indicator; cacheStdError = tmp; return indicator; } }