public CommodityChannelIndex(UInt32 length)
        {
            if (length < 1)
            {
                throw new ArgumentOutOfRangeException("length");
            }

            this.length = length;

            this.sma = new Sma(length);
        }
Beispiel #2
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 BollingerBand(UInt32 length, UInt32 width)
        {
            if (width < 1 || width > 10)
            {
                throw new ArgumentOutOfRangeException("width " + width);
            }

            this.length = length;

            this.width = width;

            this.sma = new Sma(length);
        }