protected override void Calculate(int index) { if (index >= this.fLength + this.fInput.FirstIndex) { int num1 = -(Indicator.SyncIndex ? 0 : 1) * this.fLength; double Data; if (this.fStyle == EIndicatorStyle.QuantStudio) { if (index == this.fLength + this.fInput.FirstIndex) { double num2 = 0.0; for (int index1 = index; index1 > index - this.fLength; --index1) { num2 += TR.Value(this.fInput, index1); } Data = num2 / (double)this.fLength; } else { double num2 = TR.Value(this.fInput, index); Data = (this[index - 1 + num1] * (double)this.fLength + num2 - TR.Value(this.fInput, index - this.fLength)) / (double)this.fLength; } } else if (index == this.fLength + this.fInput.FirstIndex) { double num2 = 0.0; for (int index1 = index; index1 > index - this.fLength; --index1) { num2 += TR.Value(this.fInput, index1); } Data = num2 / (double)this.fLength; } else { double num2 = TR.Value(this.fInput, index); Data = (this[this.fInput.GetDateTime(index - 1)] * (double)this.fLength + num2 - TR.Value(this.fInput, index - this.fLength)) / (double)this.fLength; } this.Add(this.fInput.GetDateTime(index), Data); } else { this.Add(this.fInput.GetDateTime(index), double.NaN); } }
protected override void Calculate(int index) { double Data1 = double.NaN; if (this.fStyle == EIndicatorStyle.QuantStudio) { double Data2 = 0.0; double Data3 = 0.0; if (index >= this.fLength + this.fInput.FirstIndex) { if (index == this.fLength + this.fInput.FirstIndex) { for (int index1 = index; index1 >= index - this.fLength + 1; --index1) { Data3 += TR.Value(this.fInput, index1); Data2 += PDM.Value(this.fInput, index1); } } else { Data2 = this.fPDM[index - 1] - PDM.Value(this.fInput, index - this.fLength) + PDM.Value(this.fInput, index); Data3 = this.fTR[index - 1] - TR.Value(this.fInput, index - this.fLength) + TR.Value(this.fInput, index); } if (Data3 != 0.0) { Data1 = Data2 / Data3 * 100.0; } } this.fPDM.Add(this.fInput.GetDateTime(index), Data2); this.fTR.Add(this.fInput.GetDateTime(index), Data3); } else { double Data2 = 0.0; double Data3 = 0.0; if (index >= this.fLength + this.fInput.FirstIndex) { if (index == this.fLength + this.fInput.FirstIndex) { for (int index1 = index; index1 >= index - this.fLength + 1; --index1) { Data3 += TR.Value(this.fInput, index1); Data2 += PDM.Value(this.fInput, index1); } } else { Data2 = this.fPDM[index - 1] - this.fPDM[index - 1] / (double)this.fLength + PDM.Value(this.fInput, index); Data3 = this.fTR[index - 1] - this.fTR[index - 1] / (double)this.fLength + TR.Value(this.fInput, index); } if (Data3 != 0.0) { Data1 = Data2 / Data3 * 100.0; } } this.fPDM.Add(this.fInput.GetDateTime(index), Data2); this.fTR.Add(this.fInput.GetDateTime(index), Data3); } this.Add(this.fInput.GetDateTime(index), Data1); }
protected override void Calculate(int index) { double Data = TR.Value(this.fInput, index); this.Add(this.fInput.GetDateTime(index), Data); }