public static double Value(TimeSeries input, int index, int length, EIndicatorStyle style) { if (index < 2 * length + input.FirstIndex) { return(double.NaN); } double num1 = 0.0; double num2; if (style == EIndicatorStyle.QuantStudio) { for (int index1 = index; index1 > index - length; --index1) { num1 += DX.Value(input, index1, length); } num2 = num1 / (double)length; } else { for (int index1 = 2 * length + input.FirstIndex; index1 > length + input.FirstIndex; --index1) { num1 += DX.Value(input, index1, length, style); } double num3 = num1 / (double)length; for (int index1 = 2 * length + 1 + input.FirstIndex; index1 <= index; ++index1) { num3 = (num3 * (double)(length - 1) + DX.Value(input, index1, length, style)) / (double)length; } num2 = num3; } return(num2); }
public static double Value(TimeSeries input, int index, int length) { return(DX.Value(input, index, length, EIndicatorStyle.QuantStudio)); }