예제 #1
0
        public Chaikin(int windowSize, int interval)
            : base(0)
        {
            if (interval <= 0 || interval > windowSize)
            {
                throw new ArgumentOutOfRangeException();
            }

            _interval = interval;

            _ema  = new ExponentialMovingAverage(windowSize);
            _mahl = new CirculatedArray <double>(interval);
        }
예제 #2
0
        public MovingAverageConvergenceDivergence(int shortWindowSize, int longWindowSize, int diffWindowSize)
            : base(0)
        {
            if (shortWindowSize < 1 || longWindowSize < 1 || diffWindowSize < 1)
            {
                throw new ArgumentOutOfRangeException("No any parameter can be smaller than 1");
            }

            if (shortWindowSize >= longWindowSize)
            {
                throw new ArgumentException("short windowSize should be smaller than long windowSize");
            }

            _emaShort = new ExponentialMovingAverage(shortWindowSize);
            _emaLong  = new ExponentialMovingAverage(longWindowSize);
            _emaDiff  = new ExponentialMovingAverage(diffWindowSize);

            Values = new double[2];
        }