Пример #1
0
 public static DataArray <double> Momentum(DataArray <double> data, int periods)
 {
     if (data == null)
     {
         throw new ArgumentNullException("data", "DataArray<double> must not be null.");
     }
     if (periods <= 0)
     {
         throw new ArgumentOutOfRangeException("periods", "Periods must not be negative or zero.");
     }
     return(ChartMath.Multiply(ChartMath.Divide(data, Reference(data, -periods)), 100.0));
 }
Пример #2
0
        public static DataArray <double> RateOfChange(DataArray <double> data, int periods)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data", "DataArray<double> must not be null.");
            }
            if (periods <= 0)
            {
                throw new ArgumentOutOfRangeException("periods", "Periods must not be negative or zero.");
            }
            DataArray <double> array = Reference(data, -periods);

            return(ChartMath.Multiply(ChartMath.Divide(ChartMath.Subtract(data, array), array), 100.0));
        }
Пример #3
0
 public static DataArray <double> SimpleMovingAverage(StockSeriesData data, int periods)
 {
     return(ChartMath.Divide(ChartMath.Sum(data, periods), periods));
 }