Example #1
0
        public static double Value(TimeSeries input, int index, int length, double shift, BarData option)
        {
            if (index < length - 1 + input.FirstIndex)
            {
                return(double.NaN);
            }
            double num = SMA.Value(input, index, length, option);

            return(num + num * (shift / 100.0));
        }
Example #2
0
        public static double Value(TimeSeries input, int index, int length, BarData option)
        {
            if (index < length - 1 + input.FirstIndex)
            {
                return(double.NaN);
            }
            double num = SMA.Value(input, index, length, option);

            return((input[index, option] - num) / num * 100.0);
        }
Example #3
0
 public static double Value(TimeSeries input, int index, int length1, int length2, BarData option)
 {
     if (index >= length1 - 1 + input.FirstIndex && index >= length2 - 1 + input.FirstIndex)
     {
         return(SMA.Value(input, index, length1, option) - SMA.Value(input, index, length2, option));
     }
     else
     {
         return(double.NaN);
     }
 }
Example #4
0
 public static double Value(TimeSeries input, int index, int length, double k, BarData option)
 {
     if (index >= length - 1 + input.FirstIndex)
     {
         return(SMA.Value(input, index, length, option) + k * SMD.Value(input, index, length, option));
     }
     else
     {
         return(double.NaN);
     }
 }
Example #5
0
        public static double Value(TimeSeries input, int index, int length1, int length2)
        {
            if (index < length1 - 1 + input.FirstIndex || index < length2 - 1 + input.FirstIndex)
            {
                return(double.NaN);
            }
            DoubleSeries doubleSeries = new DoubleSeries();

            for (int index1 = index; index1 > index - Math.Max(length1, length2); --index1)
            {
                doubleSeries.Add(input.GetDateTime(index1), input[index1, BarData.Volume]);
            }
            return(SMA.Value((TimeSeries)doubleSeries, length1 - 1, length1, BarData.Close) - SMA.Value((TimeSeries)doubleSeries, length2 - 1, length2, BarData.Close));
        }
Example #6
0
        public static double Value(TimeSeries input, int index, int length, BarData option)
        {
            if (index < length - 1 + input.FirstIndex)
            {
                return(double.NaN);
            }
            double num1 = 0.0;
            double num2 = SMA.Value(input, index, length, option);

            for (int index1 = index; index1 > index - length; --index1)
            {
                num1 += (num2 - input[index1, option]) * (num2 - input[index1, option]);
            }
            return(num1 / (double)length);
        }
Example #7
0
        public static double Value(TimeSeries input, int index, int length)
        {
            if (index < length + input.FirstIndex)
            {
                return(double.NaN);
            }
            double num1 = 0.0;

            for (int index1 = index - length + 1; index1 <= index; ++index1)
            {
                num1 += TR.Value(input, index1);
            }
            double num2 = num1 / (double)length;

            return(SMA.Value(input, index, length, BarData.Typical) - num2);
        }
Example #8
0
 public static double Value(DoubleSeries input, int index, int length)
 {
     return(SMA.Value(input, index, length, BarData.Close));
 }