예제 #1
0
        public KdjStochastics(int kWindowSize, int kDecay, int jCoeff)
            : base(0)
        {
            if (kWindowSize <= 0 || kDecay <= 0 || jCoeff <= 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            _kDecay = kDecay;
            _jCoeff = jCoeff;

            _highest = new Highest(kWindowSize);
            _lowest  = new Lowest(kWindowSize);

            Values = new double[3];
        }
예제 #2
0
        public StopAndReverse(int windowSize, double accelerateFactor, double accelerateFactorStep, double maxAccelerateFactor)
            : base(windowSize)
        {
            if (windowSize <= 1 ||
                accelerateFactor <= 0.0 ||
                accelerateFactorStep <= 0.0 ||
                maxAccelerateFactor <= accelerateFactor)
            {
                throw new ArgumentException();
            }

            _highestMetric = new Highest(windowSize);
            _lowestMetric  = new Lowest(windowSize);

            _initialAccelerateFactor = accelerateFactor;
            _accelerateFactorStep    = accelerateFactorStep;
            _maxAccelerateFactor     = maxAccelerateFactor;

            _accelerateFactor = _initialAccelerateFactor;
        }
        public FractalAdaptiveMovingAverageExtend(int period, int fastMovingAverage, int slowMovingAverage)
            : base(0)
        {
            if (period <= 0)
            {
                throw new ArgumentException("period must be greater than 0");
            }

            if (period % 2 != 0)
            {
                throw new ArgumentException("period must be even number");
            }

            if (slowMovingAverage <= 0 || fastMovingAverage <= 0)
            {
                throw new ArgumentException("slow moving average or fast moving average must be greather than 0");
            }

            if (fastMovingAverage >= slowMovingAverage)
            {
                throw new ArgumentException("fast moving average must be smaller than slow moving average");
            }

            _sc         = slowMovingAverage;
            _fc         = fastMovingAverage;
            _h          = Math.Max(_period - 1, Even((_sc - _fc) / 2) + _fc);
            _period     = period;
            _halfPeriod = period / 2;
            _minAlpha   = 2.0 / (_sc + 1);
            _maxAlpha   = 1.0;
            _w          = Math.Log(_minAlpha);

            _initialFrama      = new MovingAverage(_h);
            _firstHalfHighest  = new Highest(_halfPeriod);
            _firstHalfLowest   = new Lowest(_halfPeriod);
            _secondHalfHighest = new Highest(_halfPeriod);
            _secondHalfLowest  = new Lowest(_halfPeriod);
        }
예제 #4
0
 public WilliamOverboughtOversoldIndex(int windowSize)
     : base(0)
 {
     _highest = new Highest(windowSize);
     _lowest  = new Lowest(windowSize);
 }