FastQuant.Indicators.ADX.Calculate C# (CSharp) Method

Calculate() public method

public Calculate ( int index ) : void
index int
return void
        public override void Calculate(int index)
        {
            if (index >= 2 * this.length)
            {
                double num = 0.0;
                int num2 = -2 * this.length;
                int num3 = -1 * this.length;
                if (index == 2 * this.length)
                {
                    for (int i = index; i > index - this.length; i--)
                    {
                        num += this.dx[i + num3];
                    }
                }
                else if (this.style == IndicatorStyle.QuantStudio)
                {
                    num = this[index - 1 + num2] * (double)this.length - this.dx[index - this.length + num3] + this.dx[index + num3];
                }
                else
                {
                    num = this[index - 1 + num2] * (double)(this.length - 1) + this.dx[index + num3];
                }
                double value = num / (double)this.length;
                base.Add(this.input.GetDateTime(index), value);
            }
        }