Example #1
0
        public StochasticOscillator(UInt32 kLength, UInt32 dLength, Decimal lowMarker, Decimal highMarker)
        {
            if (kLength < 1)
            {
                throw new ArgumentOutOfRangeException("kLength");
            }

            if (dLength < 1)
            {
                throw new ArgumentOutOfRangeException("dLength");
            }

            #region check markers ranges

            if (lowMarker < LowValueBound)
            {
                throw new ArgumentOutOfRangeException("lowMarker " + lowMarker + " < " + LowValueBound);
            }

            if (highMarker < LowValueBound)
            {
                throw new ArgumentOutOfRangeException("highMarker " + highMarker + " < " + LowValueBound);
            }

            if (lowMarker > HighValueBound)
            {
                throw new ArgumentOutOfRangeException("lowMarker " + lowMarker + " > " + HighValueBound);
            }

            if (highMarker > HighValueBound)
            {
                throw new ArgumentOutOfRangeException("highMarker " + highMarker + " > " + HighValueBound);
            }

            if (highMarker < lowMarker)
            {
                throw new ArgumentOutOfRangeException("highMarker or lowMarker " + highMarker + " < " + lowMarker);
            }

            this.highMarker = highMarker;

            this.lowMarker = lowMarker;

            #endregion check markers ranges

            this.length = kLength;

            this.minValue = new MinValue(length);

            this.maxValue = new MaxValue(length);

            this.sma = new Sma(dLength);
        }
        public RWilliams(UInt32 length, Decimal lowMarker, Decimal highMarker)
        {
            if (length < 1)
            {
                throw new ArgumentOutOfRangeException("length");
            }

            #region check markers ranges

            if (lowMarker < LowValueBound)
            {
                throw new ArgumentOutOfRangeException("lowMarker " + lowMarker + " < " + LowValueBound);
            }

            if (highMarker < LowValueBound)
            {
                throw new ArgumentOutOfRangeException("highMarker " + highMarker + " < " + LowValueBound);
            }

            if (lowMarker > HighValueBound)
            {
                throw new ArgumentOutOfRangeException("lowMarker " + lowMarker + " > " + HighValueBound);
            }

            if (highMarker > HighValueBound)
            {
                throw new ArgumentOutOfRangeException("highMarker " + highMarker + " > " + HighValueBound);
            }

            if (highMarker < lowMarker)
            {
                throw new ArgumentOutOfRangeException("highMarker or lowMarker " + highMarker + " < " + lowMarker);
            }

            this.highMarker = highMarker;

            this.lowMarker = lowMarker;

            #endregion check markers ranges

            this.length = length;

            this.minValue = new MinValue(length);

            this.maxValue = new MaxValue(length);
        }