Ejemplo n.º 1
0
        public Chavkin(int windowSize, int interval)
            : base(1)
        {
            if (interval <= 0 || interval > windowSize)
            {
                throw new ArgumentOutOfRangeException();
            }

            _interval = interval;

            _ema  = new ExponentialMovingAverage(windowSize);
            _mahl = new CirculatedArray <double>(interval);
        }
Ejemplo n.º 2
0
        public MovingAverageConvergenceDivergence(int shortWindowSize, int longWindowSize, int diffWindowSize)
            : base(1)
        {
            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);
        }