Пример #1
0
        private static double Sum(Bamboo.DataStructures.Queue <double> values)
        {
            double sum = 0;

            for (int i = 0; i < values.Count; i++)
            {
                sum += values[i];
            }
            return(sum);
        }
        private static decimal Sum(Bamboo.DataStructures.Queue <decimal> values)
        {
            decimal sum = 0;

            for (int i = 0; i < values.Count; i++)
            {
                sum += values[i];
            }
            return(sum);
        }
Пример #3
0
        private static decimal Max(Bamboo.DataStructures.Queue <decimal> values)
        {
            decimal max = values[0];

            for (int i = 1; i < values.Count; i++)
            {
                if (values[i] > max)
                {
                    max = values[i];
                }
            }
            return(max);
        }
Пример #4
0
        private static decimal Min(Bamboo.DataStructures.Queue <decimal> values)
        {
            decimal min = values[0];

            for (int i = 1; i < values.Count; i++)
            {
                if (values[i] < min)
                {
                    min = values[i];
                }
            }
            return(min);
        }
Пример #5
0
 public RateOfChangeFunction(int period)
 {
     this._period   = period;
     this._previous = new Bamboo.DataStructures.Queue <decimal>(period);
 }
Пример #6
0
 private static double Avg(Bamboo.DataStructures.Queue <double> values)
 {
     return(Sum(values) / values.Count);
 }
Пример #7
0
 public StandardDeviationFunction(int period)
 {
     this._period   = period;
     this._previous = new Bamboo.DataStructures.Queue <double>(period);
 }
 private static decimal Avg(Bamboo.DataStructures.Queue <decimal> values)
 {
     return(Sum(values) / values.Count);
 }
 public SimpleMovingAverageFunction(int period)
 {
     this._period   = period;
     this._previous = new Bamboo.DataStructures.Queue <decimal>(period);
 }
Пример #10
0
 public MomentumFunction(int period)
 {
     this._period   = period;
     this._previous = new Bamboo.DataStructures.Queue <decimal>(period + 1);
 }