public static DirectionalIndicatorMinus Create(int periods)
        {
            AverageDirectionalMovementMinus admMinus = AverageDirectionalMovementMinus.Create(periods);
            AverageTrueRange atr = AverageTrueRange.Create(periods);

            double Function(CandleTimeSeries series, DateTime instant)
            {
                return(admMinus[series, instant].DivideBy(atr[series, instant]));
            }

            DirectionalIndicatorMinus result = new DirectionalIndicatorMinus(Function);

            return(result);
        }
Exemplo n.º 2
0
        public static DirectionalMovementIndex Create(int periods)
        {
            DirectionalIndicatorPlus  diPlus  = DirectionalIndicatorPlus.Create(periods);
            DirectionalIndicatorMinus diMinus = DirectionalIndicatorMinus.Create(periods);

            double Function(CandleTimeSeries series, DateTime instant)
            {
                double diDiff = Math.Abs(diPlus[series, instant] - diMinus[series, instant]);
                double diSum  = diPlus[series, instant] + diMinus[series, instant];
                double dx     = diDiff.DivideBy(diSum);

                return(dx);
            }

            DirectionalMovementIndex index = new DirectionalMovementIndex(Function);

            return(index);
        }